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

Merged
merged 1 commit into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion dandi/cli/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,9 @@ def main(ctx, log_level, pdb=False):
root.addHandler(handler)

lgr.info(
"dandi v%s, hdmf v%s, pynwb v%s, h5py v%s",
"dandi v%s, dandischema v%s, hdmf v%s, pynwb v%s, h5py v%s",
__version__,
get_module_version("dandischema"),
get_module_version("hdmf"),
get_module_version("pynwb"),
get_module_version("h5py"),
Expand Down
16 changes: 10 additions & 6 deletions dandi/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,9 @@
if digester is not None:
break
if digester is None:
lgr.warning("Found no digests in hashlib for any of %s", str(digests))
lgr.warning(

Check warning on line 688 in dandi/download.py

View check run for this annotation

Codecov / codecov/patch

dandi/download.py#L688

Added line #L688 was not covered by tests
"%s - found no digests in hashlib for any of %s", path, str(digests)
)

# TODO: how do we discover the total size????
# TODO: do not do it in-place, but rather into some "hidden" file
Expand Down Expand Up @@ -718,7 +720,8 @@
warned = True
# Yield ERROR?
lgr.warning(
"Downloaded %d bytes although size was told to be just %d",
"%s - downloaded %d bytes although size was told to be just %d",
path,
downloaded,
size,
)
Expand Down Expand Up @@ -746,14 +749,15 @@
*RETRY_STATUSES,
)
):
lgr.debug("Download failed: %s", exc)
lgr.debug("%s - download failed: %s", path, exc)

Check warning on line 752 in dandi/download.py

View check run for this annotation

Codecov / codecov/patch

dandi/download.py#L752

Added line #L752 was not covered by tests
yield {"status": "error", "message": str(exc)}
return
# if is_access_denied(exc) or attempt >= 2:
# raise
# sleep a little and retry
lgr.debug(
"Failed to download on attempt #%d: %s, will sleep a bit and retry",
"%s - failed to download on attempt #%d: %s, will sleep a bit and retry",
path,
attempt,
exc,
)
Expand All @@ -768,11 +772,11 @@
if digest != final_digest:
msg = f"{algo}: downloaded {final_digest} != {digest}"
yield {"checksum": "differs", "status": "error", "message": msg}
lgr.debug("%s is different: %s.", path, msg)
lgr.debug("%s - is different: %s.", path, msg)

Check warning on line 775 in dandi/download.py

View check run for this annotation

Codecov / codecov/patch

dandi/download.py#L775

Added line #L775 was not covered by tests
return
else:
yield {"checksum": "ok"}
lgr.debug("Verified that %s has correct %s %s", path, algo, digest)
lgr.debug("%s - verified that has correct %s %s", path, algo, digest)
else:
# shouldn't happen with more recent metadata etc
yield {
Expand Down
Loading