-
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
Update upload code for changes in API #479
Conversation
Codecov Report
@@ Coverage Diff @@
## master #479 +/- ##
===========================================
+ Coverage 64.83% 82.75% +17.92%
===========================================
Files 59 59
Lines 5991 6048 +57
===========================================
+ Hits 3884 5005 +1121
+ Misses 2107 1043 -1064
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An initial quick review: I have not spotted anything "incorrect" but we should switch away from sha256 for upload/download; and fix those uuid
s in variable names.
FWIW: initial upload attempt didn't succeed yet
*$> DANDI_DEVEL=1 dandi upload -i dandi-api --validation=ignore sub-RAT123/sub-RAT123.nwb
2021-03-19 18:40:38,432 [ INFO] Found 1 files to consider
PATH SIZE ERRORS UPLOAD STATUS MESSAGE
sub-RAT123/sub-RAT123.nwb 18.8 kB 1 ERROR Error 500 while sending PO...
Summary: 18.8 kB 1 with errors 1 ERROR 1 Error 500 while sending ...
2021-03-19 18:40:39,719 [ INFO] Logs saved in /home/yoh/.cache/dandi-cli/log/20210319224036Z-7318.log
(dandi-devel) (git)/mnt/backup/dandi/dandisets/000027:[master]
#27 !1158 [0].....................................:Fri Mar 19 18:40:39:.
drogon:/mnt/backup/dandi/dandisets/000027
$> cat /home/yoh/.cache/dandi-cli/log/20210319224036Z-7318.log
2021-03-19T18:40:36-0400 [INFO ] dandi 7318:140182937339264 [META] sys.argv = ['/home/yoh/miniconda3/envs/dandi-devel/bin/dandi', 'upload', '-i', 'dandi-api', '--validation=ignore', 'sub-RAT123/sub-RAT123.nwb']
2021-03-19T18:40:36-0400 [INFO ] dandi 7318:140182937339264 [META] os.getcwd() = /mnt/backup/dandi/dandisets/000027
2021-03-19T18:40:38-0400 [INFO ] dandi 7318:140182937339264 Found 1 files to consider
2021-03-19T18:40:38-0400 [ERROR ] dandi 7318:140182342420224 Error 404 while sending POST request to https://api.dandiarchive.org/api/blobs/digest/: {"detail":"Not found."}
2021-03-19T18:40:39-0400 [ERROR ] dandi 7318:140182342420224 Error 500 while sending POST request to https://api.dandiarchive.org/api/uploads/initialize/:
<!doctype html>
<html lang="en">
<head>
<title>Server Error (500)</title>
</head>
<body>
<h1>Server Error (500)</h1><p></p>
</body>
</html>
2021-03-19T18:40:39-0400 [INFO ] dandi 7318:140182937339264 Logs saved in /home/yoh/.cache/dandi-cli/log/20210319224036Z-7318.log
@yarikoptic I added a test that uploads & downloads an empty file, but the upload fails with:
cc: @dchiquito |
ok, filed a dedicated dandi/dandi-archive#168 . So let's skip (comment out) such a test and proceed to length 1 ;) |
@yarikoptic I'm now manually testing uploading a zero-byte file and a one-byte file to https://gui-beta-dandiarchive-org.netlify.app/#/dandiset/000029. The zero-byte file is failing for the reason above, and the upload of the one-byte file is failing with a 500 server error (with no further details) on the request to @dchiquito Looking at the Papertrail logs, it appears that something on the server is trying to use an invalid UUID as a UUID. |
@jwodder It looks like AWS returned that bizarrely shaped key instead of a UUID. dandi/dandi-archive#170 should fix the issue. |
@dchiquito Isn't the response to POSTing to the |
@jwodder the |
@dchiquito After updating for that, uploads to the server are now failing with:
The logs indicate the ETags do match, though. Am I supposed to surround the ETag in double-quotes when submitting it to the server? This error does not occur when testing against the Dockerized environment. |
@jwodder I agree everything matches. I'm adding some logging, though I suspect you are right and AWS is wrapping it in |
@jwodder just validated that upload through the API and it worked. It was indeed S3 returning double quotes. Everything should be hunky dory now. |
woohoo -- green again! @jwodder please "check" the boxes in the original issue description whenever those are addressed/done |
Upload on 3TB file errored out for me with LooseVersion' object has no attribute 'version'drogon:/tmp/000029
*$> DANDI_DEVEL=1 dandi upload -i dandi-api --allow-any-path largeuploads/blobs/f5d/aac/79d9c6c1ba2439200d45680f1cb941087750a000e484ea2973232709d2
2021-03-23 19:03:10,248 [ WARNING] A newer version (0.12.0) of dandi/dandi-cli is available. You are using 0.11.0+52.g345866d
2021-03-23 19:03:11,770 [ INFO] Found 1 files to consider
PATH SIZE ERRORS UPLOAD STATUS MESSAGE
largeuploads/blobs/f5d/aac/79d9c6c1ba2439200d45680f1cb941087750a000e484ea2973232709d2 3.6 TB ERROR 'LooseVersion' object has no attribute 'version'
Summary: 3.6 TB 1 ERROR 1 'LooseVersion' object has no attribute 'version'
2021-03-23 23:30:04,598 [ INFO] Logs saved in /home/yoh/.cache/dandi-cli/log/20210323230310Z-12419.log
(dandi-devel)
#52 !1183 [0].....................................:Tue Mar 23 23:30:04:.
drogon:/tmp/000029
$> cat /home/yoh/.cache/dandi-cli/log/20210323230310Z-12419.log
2021-03-23T19:03:10-0400 [INFO ] dandi 12419:139962955457920 [META] sys.argv = ['/home/yoh/miniconda3/envs/dandi-devel/bin/dandi', 'upload', '-i', 'dandi-api', '--allow-any-path', 'largeuploads/blobs/f5d/aac/79
d9c6c1ba2439200d45680f1cb941087750a000e484ea2973232709d2']
2021-03-23T19:03:10-0400 [INFO ] dandi 12419:139962955457920 [META] os.getcwd() = /tmp/000029
2021-03-23T19:03:10-0400 [WARNING ] dandi 12419:139962955457920 A newer version (0.12.0) of dandi/dandi-cli is available. You are using 0.11.0+52.g345866d
2021-03-23T19:03:11-0400 [INFO ] dandi 12419:139962955457920 Found 1 files to consider
2021-03-23T23:30:04-0400 [INFO ] dandi 12419:139962955457920 Logs saved in /home/yoh/.cache/dandi-cli/log/20210323230310Z-12419.log
(dandi-devel)
#53 !1184 [0].....................................:Wed Mar 24 08:29:45:.
drogon:/tmp/000029
$> dandi --version
0.11.0+52.g345866d
|
@yarikoptic Could you rerun with |
--devel-debug*$> DANDI_DEVEL=1 dandi upload -i dandi-api --allow-any-path --devel-debug largeuploads/blobs/f5d/aac/79d9c6c1ba2439200d45680f1cb941087750a000e484ea2973232709d2
2021-03-24 08:48:26,249 [ WARNING] A newer version (0.12.0) of dandi/dandi-cli is available. You are using 0.11.0+52.g345866d
2021-03-24 08:48:27,948 [ INFO] Found 1 files to consider
{'size': 3628888939868}
{'status': 'digesting'}
{'status': 'pre-validating'}
2021-03-24 08:48:28,326 [ INFO] Logs saved in /home/yoh/.cache/dandi-cli/log/20210324124825Z-15856.log
Traceback (most recent call last):
File "/home/yoh/miniconda3/envs/dandi-devel/bin/dandi", line 33, in <module>
sys.exit(load_entry_point('dandi', 'console_scripts', 'dandi')())
File "/home/yoh/miniconda3/envs/dandi-devel/lib/python3.8/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/home/yoh/miniconda3/envs/dandi-devel/lib/python3.8/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/home/yoh/miniconda3/envs/dandi-devel/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/yoh/miniconda3/envs/dandi-devel/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/yoh/miniconda3/envs/dandi-devel/lib/python3.8/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/home/yoh/miniconda3/envs/dandi-devel/lib/python3.8/site-packages/click/decorators.py", line 33, in new_func
return f(get_current_context().obj, *args, **kwargs)
File "/home/yoh/proj/dandi/dandi-cli/dandi/cli/base.py", line 109, in wrapper
return f(*args, **kwargs)
File "/home/yoh/proj/dandi/dandi-cli/dandi/cli/cmd_upload.py", line 98, in upload
upload(
File "/home/yoh/proj/dandi/dandi-cli/dandi/upload.py", line 49, in upload
return _new_upload(
File "/home/yoh/proj/dandi/dandi-cli/dandi/upload.py", line 897, in _new_upload
for v in process_path(path, relpath):
File "/home/yoh/proj/dandi/dandi-cli/dandi/upload.py", line 775, in process_path
validation_errors = validate_file(path)
File "/home/yoh/proj/dandi/dandi-cli/dandi/validate.py", line 41, in validate_file
return pynwb_validate(filepath, devel_debug=devel_debug) + validate_dandi_nwb(
File "/home/yoh/miniconda3/envs/dandi-devel/lib/python3.8/site-packages/fscacher/cache.py", line 116, in fingerprinter
ret = fingerprinted(path, *args, **kwargs_)
File "/home/yoh/miniconda3/envs/dandi-devel/lib/python3.8/site-packages/joblib/memory.py", line 591, in __call__
return self._cached_call(args, kwargs)[0]
File "/home/yoh/miniconda3/envs/dandi-devel/lib/python3.8/site-packages/joblib/memory.py", line 534, in _cached_call
out, metadata = self.call(*args, **kwargs)
File "/home/yoh/miniconda3/envs/dandi-devel/lib/python3.8/site-packages/joblib/memory.py", line 761, in call
output = self.func(*args, **kwargs)
File "/home/yoh/miniconda3/envs/dandi-devel/lib/python3.8/site-packages/fscacher/cache.py", line 84, in fingerprinted
return f(path, *args, **kwargs)
File "/home/yoh/proj/dandi/dandi-cli/dandi/pynwb_utils.py", line 268, in validate
if loosever and loosever < "2.1.0":
File "/home/yoh/miniconda3/envs/dandi-devel/lib/python3.8/distutils/version.py", line 52, in __lt__
c = self._cmp(other)
File "/home/yoh/miniconda3/envs/dandi-devel/lib/python3.8/distutils/version.py", line 335, in _cmp
if self.version == other.version:
AttributeError: 'LooseVersion' object has no attribute 'version' |
damn - I think I was running an outdated version of this PR (and I thought I had checked)... will hard reset and redo now edit: so we again would need to wait for re-digetsion, but at least it succeeded on some random tiny file so I know that now using correct state of the PR edit2: I wish |
@yarikoptic I see the problem. EDIT: I've pushed a patch. |
THANKS! I will interrupt, update, redo edit: also FWIW tested on some other non nwb h5 file /usr/lib/python3/dist-packages/tables/tests/scalar.h5 just in case |
Since CI is happy and basic testing is happy and that huge upload would take awhile, let's take this PR from draft and merge? This should make CI happy for PRs so we do miss us breaking anything unrelated |
Closes #478.
TODOs:
0-length and(delaying fixing for 0 length for now, see e.g. DandiETag: (possibly) for 0-length file produce 1 part #488) some small (1 byte) files: should be coded in a test against a fixture instance and manually on e.g. https://gui-beta-dandiarchive-org.netlify.app/#/dandiset/000029drogon:/mnt/backup/dandi/dandiarchive-s3-backup/largeuploads/blobs/f5d/aac/79d9c6c1ba2439200d45680f1cb941087750a000e484ea2973232709d2
(again -- to be placed somewhere in 000029, validation could be ignored since IIRC it is not necessarily nwb)