Skip to content

Draft: Update zenodo response https status handlinbg - #191

Open
ErikGro wants to merge 1 commit into
mainfrom
ErikGro/190
Open

ErikGro wants to merge 1 commit into
mainfrom
ErikGro/190

Conversation

@ErikGro

@ErikGro ErikGro commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

@brainless-bot

brainless-bot Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

🤖 Code Formatting Reminder

Hello there! 👋 It looks like the code in this pull request might benefit from some formatting improvements.
Fix the issues locally or use our auto format action by commenting /format on this PR!

Code style: black

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The 404 contract change breaks an existing test, while staging-directory errors bypass local fallback and owner-only published permissions prevent shared access to assets.

3 open issues
What changed in this PR

This PR addresses #190 by improving Zenodo failure handling for atlas and SynthStrip weight downloads, allowing existing local assets to remain usable during service failures.

Changes:

  • Adds HTTP request timeouts and routes metadata errors to the local-copy fallback.
  • Skips empty or unparseable local version directories.
  • Stages downloads in temporary directories and retains the old version if an upgrade fails.
File Description
brainles_preprocessing/​utils/​zenodo.py Improves Zenodo error handling, local version selection, and staged asset replacement.

Review effort: Balanced

f"Zenodo returned an unexpected status for record "
f"'{self.record_id}' ({response.status_code=})."
)
return None
Comment on lines +255 to +260
self.target_dir.mkdir(parents=True, exist_ok=True)
# Staged inside target_dir so the final move is a rename on the same
# filesystem. The leading dot keeps it out of _glob_pattern().
staging_dir = Path(
tempfile.mkdtemp(prefix=f".tmp_{self.record_id}_", dir=self.target_dir)
)
f"Failed to delete {path}: {excinfo}"
),
)
staging_dir.replace(folder)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] HTTP error responses from Zenodo bypass the "use local copy" fallback

2 participants