Skip to content

Upload: bound git-annex add workers and feed paths through --batch - #1649

Closed
bruAristimunha wants to merge 1 commit into
nemarOrg:feature/issue-1671-epic-bru-upload-fixesfrom
bruAristimunha:fix/issue-1455-bounded-annex-add
Closed

bruAristimunha wants to merge 1 commit into
nemarOrg:feature/issue-1671-epic-bru-upload-fixesfrom
bruAristimunha:fix/issue-1455-bounded-annex-add

Conversation

@bruAristimunha

@bruAristimunha bruAristimunha commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Problem

#1455: the tracking step runs git annex add -- <500 paths> per chunk with no worker count (src/lib/git-annex/init.ts, call site src/lib/upload/transfer.ts), so a machine-wide annex.jobs decides how many hashers hit the filesystem, and on network filesystems the argv form stalls in filter-process (the NFS evidence in #1455). On nm000359 (Ceph) tracking ran at about 34 files/min.

Change

  • gitAnnexAdd always passes an explicit -J (default 4, clamped 1..32), also for the whole-tree "." callers.
  • A path list goes through git annex add --batch -z --json --json-error-messages on stdin, still in 500-path chunks so each finished chunk persists for resume. Per-file failures are parsed from the JSON. A missing path still fails loudly (checked per chunk, which keeps the existing mid-chunk-failure semantics).
  • New nemar dataset upload --annex-jobs <n>, separate from -j (S3 streams). The plan and the tracking spinner show both.

Behavior to know about

Ceph benchmark (8 CPU node, git 2.53, git-annex 10.20260717, fresh adjusted/unlocked repo, 600 × 120 KB .edf + 600 JSON): 534 s before (67 files/min), 462 s with --batch -z -J4 (78 files/min), about 14 %. On Ceph, many small files are bound by per-file metadata and sync work, not hashing, so this is not a step change; the main value is the one #1455 documents (no argv filter-process stall, explicit worker count).

Not done here: the inactivity diagnostic #1455 also asks for. The save-step half of #1455 is in #1647.

Part of #1455

Testing

  • test/annex-add-batch-jobs.unit.test.ts (new, 7 tests): default and clamping; JSON failure parsing; and with real git-annex, --batch with an explicit -J across chunks (asserted through GIT_TRACE, with annex.jobs=cpus set and overridden), a missing path fails loudly, re-adding annexed unchanged files is a quiet success (resume), forceLarge/checkGitignore still apply.

  • The existing add/resume/chunk tests are unchanged. 16 files that import the changed modules: 250 pass, 1 skip, 0 fail (on current dev).

  • bun run typecheck, biome check on the changed files.

  • CI api-test and integration-dev fail on this PR because it comes from a fork: both call the dev API with the TEST_*_API_KEY secrets, which GitHub does not pass to fork pull requests, so the authenticated cases fail and the unauthenticated ones pass. lint, unit-pure and e2e-sandbox run normally.

The tracking step ran 'git annex add -- <500 paths>' per chunk with no
worker count, so a machine-wide annex.jobs decided how many hashers hit the
filesystem, and on network filesystems the argv form stalled in
filter-process (nemarOrg#1455: NFS evidence; nm000359: ~34 files/min on Ceph).

- gitAnnexAdd always passes an explicit -J (default 4, clamped 1..32).
- A path list is fed through 'git annex add --batch -z --json' on stdin,
  still chunked so every finished chunk persists for resume; per-file
  failures are parsed from the JSON records, and a missing path still
  fails loudly (checked per chunk).
- New 'nemar dataset upload --annex-jobs <n>' keeps local hashing separate
  from -j (S3 streams); the plan and the tracking spinner show both.
@neuromechanist
neuromechanist changed the base branch from dev to feature/issue-1671-epic-bru-upload-fixes October 7, 2026 22:06
neuromechanist added a commit that referenced this pull request Oct 9, 2026
Adapted from Bru's PR #1649 onto epic #1671. Adds bounded NUL-fed batch transport for path-list annex adds and treats unanswered missing paths and filesystem errors correctly while preserving staged-blob recovery.

Keep issue #1455 open: the local worker-count default, controlled benchmark, and inactivity diagnostic remain unresolved.EOF
@neuromechanist

Copy link
Copy Markdown
Contributor

This original source PR is superseded by epic replacements #1688, #1689, #1690, #1692, and #1694. The complete epic landing is tracked by #1702. #1455 remains open for full upload/save acceptance; closing this source PR does not close that issue.

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.

2 participants