Skip to content
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

ENH: log dandischema version and ensure we log (consistently) path for log messages in download #1499

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

yarikoptic
Copy link
Member

hopefully would be in assist to troubleshoot issues with downloads, like the one now reported by @Kevancic on slack

@yarikoptic yarikoptic added DX Developer eXperience patch Increment the patch version when merged labels Sep 12, 2024
Copy link

codecov bot commented Sep 12, 2024

Codecov Report

Attention: Patch coverage is 70.90909% with 32 lines in your changes missing coverage. Please review.

Project coverage is 88.17%. Comparing base (9580513) to head (8d739b7).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
dandi/download.py 35.55% 29 Missing ⚠️
dandi/cli/command.py 0.00% 1 Missing ⚠️
dandi/dandiapi.py 80.00% 1 Missing ⚠️
dandi/tests/test_download.py 98.30% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1499      +/-   ##
==========================================
- Coverage   88.51%   88.17%   -0.35%     
==========================================
  Files          77       77              
  Lines       10572    10671      +99     
==========================================
+ Hits         9358     9409      +51     
- Misses       1214     1262      +48     
Flag Coverage Δ
unittests 88.17% <70.90%> (-0.35%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

dandi/tests/test_download.py Dismissed Show resolved Hide resolved
else:
lgr.debug(
"Download directory found, but digests do not match; starting new download"
"%s - download directory found, but digests do not match;"
" starting new download",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would digests.keys() and self. digests.keys() be useful to know here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I felt like I wondered the same and then dismissed as it would be "too much noise". but now not sure -- it might be... yet to decide

dandi/download.py Outdated Show resolved Hide resolved
dandi/tests/test_download.py Show resolved Hide resolved
Also shortened the log line to not include traceback
not sure why was not failing for me locally but fails on CI
That is my guess for what is happening in

    ________________________ test_DownloadDirectory_basic _________________________
    dandi\tests\test_download.py:1048: in test_DownloadDirectory_basic
        with DownloadDirectory(tmp_path, digests={}) as dl:
    dandi\download.py:889: in __exit__
        self.writefile.replace(self.filepath)
    C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\pathlib.py:1247: in replace
        self._accessor.replace(self, target)
    E   PermissionError: [WinError 5] Access is denied: 'C:\\Users\\runneradmin\\AppData\\Local\\Temp\\pytest-of-runneradmin\\pytest-0\\test_DownloadDirectory_basic0.dandidownload\\file' -> 'C:\\Users\\runneradmin\\AppData\\Local\\Temp\\pytest-of-runneradmin\\pytest-0\\test_DownloadDirectory_basic0'
dandi/download.py Show resolved Hide resolved
@@ -853,12 +869,35 @@ def __exit__(
exc_tb: TracebackType | None,
) -> None:
assert self.fp is not None
if exc_type is not None or exc_val is not None or exc_tb is not None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exc_tb is not used in the log here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

first I had it but then kicked out from actual log -- the point is that if any of them provided, exception happened.

Very unlikely but it could be that directory already existed but without
checksum file for some reason.
no v prefix since is not providing any information on top; sorting for deterministic order
…IVE_RETRY mode

This is all to address that odd case with 000026 where connection keeps interrupting.
Unclear why so adding more specific cases handling and allowing for such an aggressive
retrying where we would proceed as long as we are getting something (but sleep would also increase)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DX Developer eXperience patch Increment the patch version when merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants