Repository navigation
Upload: renew S3 credentials during long copies - #1648
Closed
bruAristimunha wants to merge 2 commits into
Closed
bruAristimunha wants to merge 2 commits into
bruAristimunha wants to merge 2 commits into
Conversation
- git annex copy is driven with --json --json-error-messages; filesCopied counts success records instead of scraping 'copy ... ok' lines (nm000358 logged 'Uploaded 0 data files' while all 165 keys were recorded at nemar-s3 during that copy). - The copy set is taken from the location log (annexed paths not yet at nemar-s3), and the post-copy check now requires EVERY annexed file to be recorded at the remote, not only this run's targets. - A data file larger than the annex size threshold that git-annex did not annex (policy overridden, e.g. an inherited .gitattributes) now fails the upload instead of being committed to git silently. - saveDataset takes skipContentCheckPaths; the upload's save step marks the annexed paths assume-unchanged around git add -A/status/commit so git does not stream every freshly annexed unlocked file through git-annex filter-process (zero-stat index entries after git annex add). Refs nemarOrg#1455. - The success line states sent / already-present / verified totals.
Upload credentials are 2 h STS sessions; the upload requested them once and ran one git annex copy over everything, so TB-scale uploads died part-way with ExpiredToken and had to be re-run by hand (the iEEG campaign wrapped the upload in a 12-attempt retry loop). The pending paths (from the location log) are now copied in bounded batches (200 files / 50 GiB). Before each batch the lease is renewed when what is left would not cover a 20 min margin plus the longest batch seen; each batch runs under a deadline just before expiry, and a batch that is killed at the deadline or fails with an expired-credential error is retried with fresh credentials. Renewals are bounded (48), and two consecutive renewals that deliver nothing stop with an explicit error. copyPathsToAnnexRemote gains an optional absolute deadline.
9 tasks done
neuromechanist
changed the base branch from
dev
to
feature/issue-1671-epic-bru-upload-fixes
October 7, 2026 22:06
This was referenced Oct 9, 2026
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
#1644: upload credentials are one STS session capped at 2 h (
backend/src/routes/datasets/upload.ts,duration_secondsmax 7200), requested once, followed by a singlegit annex copyover everything. A copy that runs longer fails every remaining file with an expired token and has to be re-run by hand.Change
New
src/lib/upload/s3-copy-session.ts:git annex copyis stopped rather than left to fail every file with ExpiredToken.copyPathsToAnnexRemotetakes an optional absolute deadline.Behavior to know about
AWS_*from the environment before its cached credentials, which the S3 special remote does.git annex copyruns.Closes #1644
Testing
test/upload-sts-refresh.unit.test.ts(new, 12 tests), simulated clock and copy function: a 3 h copy renews once and no batch is killed; ExpiredToken and deadline retries; the renewal bound; no-progress stop; non-credential errors are not retried; batch limits by count and size.Related suites: 237 pass, 0 fail across 16 files that import the changed modules (on this branch rebased on current
dev).bun run typecheck,biome checkon the changed files.Not exercised against live S3 with a real credential expiry.
CI
api-testandintegration-devfail on this PR because it comes from a fork: both call the dev API with theTEST_*_API_KEYsecrets, which GitHub does not pass to fork pull requests, so the authenticated cases fail and the unauthenticated ones pass.lint,unit-pureande2e-sandboxrun normally.