-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
download: download into a temp file + rename / clean upon failed attempt #198
Comments
We could do what Safari and Firefox do: When downloading to |
Sounds good @jwodder ! |
Please implement this one for current master. This logic is agnostic of what is underlying service (API vs girder) so we should be good even after going API all the way. |
|
download into
raise an exception. We already have |
Exactly what metadata should be stored in the directory and checked when resuming download? Just the checksum for the complete file? |
Storing a checksum should be sufficient, but this issue PR does not necessarily should address resumed downloads (although could if only for API calls/downloader, girder will be gone anyways). |
Download files to temporary directory containing metadata
As of 0.6.0 implementation
download
downloads directly into the target location.In common scenarios it is better to download into some temporary location and then move into the target location upon successful completion. That avoids users ending up with partial downloads which represent broken .nwb files without knowing that they are partial downloads. Similar strategy is used e.g. by chrome browser and girder client which we stopped used for download (only to initiate streamed download).
Unlike girder_client we do not want to download to a TMPDIR folder, since file could be large and
/tmp
could be lacking that much space and transfer into target location could entail additional delay. I think the best would be to download into a temp file in the target location folder but with some prefix or suffix. E.g. for filea/blah.nwb
, keep original one (if present) file (until renaming "into" it) and download intoa/blah.nwb-dandidownload
to be renamed intoa/blah.nwb
upon successful completion.What to do if download is interrupted (my preferences are emphasized). We could
At the beginning of the download, what to do if a partial download found:
dandi
client running ATM for the same dandiset. I think that the easiest would be for a download to establish a lock file, e.g. using fasteners library, to reside probably along side inblah.nwb.lck
(well, there iswrite_locked
helpers so may be a separate lck file is not even needed)-dandidownload-<CHECKSUM>
) checksum we obtain from the metadata? If no checksum was "recorded" - download from the start. If there was checksum, and matches what is about to be downloaded, just roll back a chunk and try to resume... if resume fails (due to read in "check" chunk differs as in Add "resume" functionality to download #189) - start from the beginning.But may be if we rely on checksum we should just download into some
.dandi/tmp/<CHECKSUM>
and lock there? What do you think @jwodder ?The text was updated successfully, but these errors were encountered: