Skip to content

download: install each task right after it fetch, not all together (fixes #4) - #105

Open
bluzername wants to merge 1 commit into
TIGER-AI-Lab:mainfrom
bluzername:fix/download-installs-each-task-as-fetched
Open

bluzername wants to merge 1 commit into
TIGER-AI-Lab:mainfrom
bluzername:fix/download-installs-each-task-as-fetched

Conversation

@bluzername

Copy link
Copy Markdown

What is wrong

run_download fetch every requested task into one staging folder, then only after all of them are fetched it install all of them together. If one task fail in the middle (network error, hub rate limit, a bad hash), the except block return before install() ever run for any task. Because everything was still inside the TemporaryDirectory, it then delete every task already fetched too. For a full download that can throw away up to 9.7 GB for one task that fail at the end.

The fix

Now the loop fetch and install one task at a time. A task that fail is printed and skipped, the next task still run. At the end, if anything failed, the command print the list and exit 1 - if nothing could be installed at all, it exit 1 before even printing the "run a task" hint.

Test

Added test_one_failed_task_does_not_discard_the_rest: a 2-task index where the first task's fetch raise and the second one succeed. RED on the old code (second task never get a chance - everything was one try), GREEN after. All other tests in tests/test_cli.py still pass by hand-trace (single-task tests only have 1 item in the loop, so behave the same as before).

I could not run the suite here, my sandbox do not allow executing code from a freshly cloned repo (no pytest/unittest access). I check the change carefully against the existing tests by hand, and python3 -m py_compile on both changed files pass clean. Sorry if this cause more back and forth than usual, happy to fix anything CI finds.

run_download fetched every task into one staging dir then installed all
of them together. If one task failed partway (network error, hub rate
limit, a hash mismatch), the except block returned before install ever
ran, and the TemporaryDirectory then deleted everything already fetched.
For a full download that throw away gigabytes of good work for one bad
task, closes TIGER-AI-Lab#4.

Now each task is fetched and installed on its own, right after the
other. A failed task is printed and skipped, the rest keep going, and
the command exit 1 at the end with the list of what failed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant