Skip to content

DiLoCo #218: requeue worker on transient backend-derivation timeout + modal Reset-to-defaults - #236

Merged
jdinalt merged 3 commits into
devfrom
fix/diloco-218-backend-retry
Jun 14, 2026
Merged

jdinalt merged 3 commits into
devfrom
fix/diloco-218-backend-retry

Conversation

@jdinalt

@jdinalt jdinalt commented Jun 14, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes issue #218 (the launch-time backend-derivation race that failed all 4 workers of a smoke run), plus a small DiLoCo-server-modal usability add.

#218 — requeue instead of fail on transient unreachability (scheduler.py)

The scheduler derives a worker's sync backend by GETting the param server's /info at launch — a single attempt, 15 s timeout, no retry. A worker dispatched in the brief window where the server is still finishing startup (or momentarily busy as 4 workers make first contact at once) was permanently failed by that one timed-out probe, even though the server was healthy seconds later. (Observed live; re-submitting against the warm server worked.)

The probe runs inside the serial dispatch tick, so a blocking sleep-retry would stall every other dispatch. Instead:

  • per-attempt timeout shortened to 5 s (_DILOCO_DERIVE_TIMEOUT_S) so one probe can't hold up the tick;
  • _diloco_query_info raises a typed _DilocoServerUnreachable; _launch catches it and requeues the worker — drops the record (freeing the reserved GPU) and re-adds the item with its original submitted_at (FIFO position kept) — for the next tick. It fails for real only after _DILOCO_DERIVE_RETRY_BUDGET_S (180 s), covering a slow server startup without hanging forever on a server that never comes up.

A permanent config error (backend/topology mismatch) stays a plain RuntimeError and still fails immediately — only the network-unreachable case is retried.

webui — "Reset to defaults" on the DiLoCo server modal

The other service modals have it; the DiLoCo one didn't, making it hard to definitively clear persisted ad-hoc overrides. Create-mode only.

Tests

test_scheduler_diloco_retry.py: typed-exception raise, requeue-within-budget, fail-after-budget, success-clears-bookkeeping. Scheduler + diloco-env suites green; black/isort clean; webui tsc --noEmit clean.

Docs

docs/trainers/diloco-backends.md — the "fails loud if unreachable" line now describes the requeue/retry.

🤖 Generated with Claude Code

jdinalt and others added 3 commits June 14, 2026 23:15
…ntly unreachable (#218)

The scheduler derives a worker's sync backend by GETting the param server's
/info at launch. That ran as a single attempt with a 15s timeout and no retry,
so a worker dispatched in the brief window where the server is still finishing
startup (or momentarily busy as 4 workers make first contact at once) was
permanently FAILED by one timed-out probe — even though the server was healthy
seconds later. Observed live: all 4 workers of a smoke run failed with 'backend
could not be derived ... unreachable (timed out)'; re-submitting against the warm
server worked.

The probe runs inside the serial dispatch tick, so a blocking sleep-retry would
stall every other dispatch. Instead:
- shorten the per-attempt timeout to 5s (_DILOCO_DERIVE_TIMEOUT_S) so one probe
  can't hold up the tick, and
- raise a typed _DilocoServerUnreachable; _launch catches it and REQUEUES the
  worker (drop the record — freeing the reserved GPU — and re-add the item with
  its original submitted_at, so FIFO position is kept) for the next tick. It
  fails for real only after _DILOCO_DERIVE_RETRY_BUDGET_S (180s) of retries,
  covering a slow server startup without hanging forever on a server that never
  comes up.

A permanent config error (backend/topology mismatch) is a plain RuntimeError and
still fails immediately — only the network-unreachable case is retried.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The other service modals (e.g. DatasetServerModal) have it; the DiLoCo one
didn't, making it hard to definitively clear persisted ad-hoc overrides when
starting something different. Create-mode only (edit mode reflects a saved
service); clears the persisted blob and restores every field to its default.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ailure

Review follow-up: _diloco_derive_first_seen leaked an entry when a worker in the
#218 retry window was cancelled (cancel_queued) or later failed via a non-
unreachable error. Prune it in both paths. (+ regression test)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jdinalt
jdinalt merged commit 197da52 into dev Jun 14, 2026
1 check passed
@jdinalt
jdinalt deleted the fix/diloco-218-backend-retry branch June 14, 2026 23:20
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.

1 participant