fix click probs

This commit is contained in:
jonny 2023-10-26 20:11:01 -07:00
parent 76c8d086f9
commit 05240668a8

View file

@ -1,7 +1,8 @@
from pathlib import Path from pathlib import Path
from tqdm import trange from tqdm import trange
from datetime import datetime from datetime import datetime
import sys
import click
from dandi.consts import ZARR_EXTENSIONS, metadata_all_fields from dandi.consts import ZARR_EXTENSIONS, metadata_all_fields
from dandi.dandiarchive import DandisetURL, _dandi_url_parser, parse_dandi_url from dandi.dandiarchive import DandisetURL, _dandi_url_parser, parse_dandi_url
from dandi.cli.cmd_download import download from dandi.cli.cmd_download import download
@ -36,28 +37,31 @@ def check_nwb(dandiset:int) -> bool:
def main(): def main():
for i in trange(MAX_DANDISET): for i in trange(MAX_DANDISET):
if not check_nwb(i) or i in SKIP_DANDISETS: if not check_nwb(i) or i in SKIP_DANDISETS:
with open(LOG_TXT, 'a') as lfile: with open(LOG_TXT, 'a') as lfile:
lfile.write(f"{datetime.now().isoformat()} - {i:03d} - SKIP\n") lfile.write(f"{datetime.now().isoformat()} - {i:03d} - SKIP\n")
continue continue
id = DANDI_ID.format(i) id = DANDI_ID.format(i)
try: try:
download( download.main([
[
id, id,
'-o', str(OUT_DIR), '-o', str(OUT_DIR),
'--existing', 'refresh', '--existing', 'refresh',
'--jobs', str(JOBS) '--jobs', str(JOBS)
] ], standalone_mode=False
) )
print('\nafterdl')
with open(LOG_TXT, 'a') as lfile:
lfile.write(f"{datetime.now().isoformat()} - {i:03d} - GET\n")
except KeyboardInterrupt:
sys.exit(1)
except Exception as e: except Exception as e:
print('\nexception')
with open(LOG_TXT, 'a') as lfile: with open(LOG_TXT, 'a') as lfile:
lfile.write(f"{datetime.now().isoformat()} - {i:03d} - ERROR\n") lfile.write(f"{datetime.now().isoformat()} - {i:03d} - ERROR\n")
lfile.write(str(e)) lfile.write(str(e))
continue # continue
with open(LOG_TXT, 'a') as lfile:
lfile.write(f"{datetime.now().isoformat()} - {i:03d} - GET\n")