andyljones / boardlaw

Scaling scaling laws with board games.
https://andyljones.com/boardlaw
MIT License
38 stars 7 forks source link

Possible Bug Accessing Training Data? #16

Closed jzf2101 closed 3 years ago

jzf2101 commented 3 years ago

Hi! The example code provided in the docs does not return training data, which suggests there may be some missing information in accessing the database? Thanks!

import b2sdk.v1 as b2
import sys
import time

run = '2021-03-26 15-30-17 harsh-wait'
dest = 'local_storage'

bucket = 'boardlaw'
api = b2.B2Api()

syncer = b2.Synchronizer(4)
with b2.SyncReport(sys.stdout, False) as reporter:
    syncer.sync_folders(
        source_folder=b2.parse_sync_folder(f'b2://boardlaw/output/pavlov/{run}', api),
        dest_folder=b2.parse_sync_folder(f'dest/{run}', api),
        now_millis=int(round(time.time() * 1000)),
        reporter=reporter)

Returns:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/b2sdk/account_info/sqlite_account_info.py in _get_account_info_or_raise(self, column_name)
    525                 cursor = conn.execute('SELECT %s FROM account;' % (column_name,))
--> 526                 value = cursor.fetchone()[0]
    527                 return value

TypeError: 'NoneType' object is not subscriptable

During handling of the above exception, another exception occurred:

MissingAccountData                        Traceback (most recent call last)
10 frames
/usr/local/lib/python3.7/dist-packages/b2sdk/account_info/sqlite_account_info.py in _get_account_info_or_raise(self, column_name)
    531                 column_name
    532             )
--> 533             raise MissingAccountData(str(e))
    534 
    535     def refresh_entire_bucket_name_cache(self, name_id_iterable):

MissingAccountData: Missing account data: 'NoneType' object is not subscriptable
andyljones commented 3 years ago

I'm out and about, but I think you can solve this by creating a backblaze account and then following the b2sdk docs to auth the library. I thought it'd work without a backblaze account, but apparently not

andyljones commented 3 years ago

Incidentally if you're building upon this work, give me an email and we'll have a chat. I'm keen to help! me@andyljones.com

jzf2101 commented 3 years ago

I think you can solve this by creating a backblaze account and then following the b2sdk docs to auth the library. I thought it'd work without a backblaze account, but apparently not

My guess is that other users may not yet have access to the bucket because I get a NonExistentBucket: No such bucket: boardlaw error when I include my credentials

andyljones commented 3 years ago

Right! Turns out I ran into this problem while proofing the release, and then... never updated the docs. Sorry for the red herring! Fix is to use the open credentials I included in the backup module, a la

from boardlaw import backup
import sys
import time

run = '2021-03-26 15-30-17 harsh-wait'
dest = 'local_storage'

bucket = 'boardlaw'
api = backup.api(bucket)

syncer = b2.Synchronizer(4)
with b2.SyncReport(sys.stdout, False) as reporter:
    syncer.sync_folders(
        source_folder=b2.parse_sync_folder(f'b2://boardlaw/output/pavlov/{run}', api),
        dest_folder=b2.parse_sync_folder(f'{run}', api),
        now_millis=int(round(time.time() * 1000)),
        reporter=reporter)

I've updated the docs to match.