Repository navigation
download: install each task right after it fetch, not all together (fixes #4) - #105
Open
bluzername wants to merge 1 commit into
Open
bluzername wants to merge 1 commit into
bluzername wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is wrong
run_downloadfetch 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 beforeinstall()ever run for any task. Because everything was still inside theTemporaryDirectory, 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 onetry), GREEN after. All other tests intests/test_cli.pystill 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_compileon both changed files pass clean. Sorry if this cause more back and forth than usual, happy to fix anything CI finds.