fix(scheduler): gate fetch flake jobs on fetch capability + adaptive fetch/eval split - #299
Merged
Merged
Conversation
Every repository FlakeJob carries a FetchFlake task and clones its source (over SSH for private repos), but the scheduler offered these jobs to any worker. A worker without the `fetch` capability would receive the job, get no SSH credentials (the server only sends them to fetch-capable workers), and fail the clone with "authentication required but no callback set". Eligibility now requires `fetch` for flake jobs carrying FetchFlake, symmetric with credential delivery. Eval-only follow-up jobs (cached source) remain servable by any worker. Fixes #252
Member
Author
|
/gradient run checks.x86_64-linux.gradient-cache |
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.
Part 1 — Fix #252: SSH fetch failing (root cause: job assignment)
authentication required but no callback set; class=Sshwas a job-assignment bug, not an SSH bug (as the reporter suspected):FlakeJobis dispatched with aRepositorysource +FetchFlaketask, which requires thefetchcapability.job_eligible_for_capsreturnedtruefor all eval jobs — never checking the worker'sfetchcapability — so a worker with onlyeval+buildcould be assigned the clone job.send_credentials_for_jobcorrectly sends the SSH key only to fetch-capable workers, so the non-fetch worker gothas_ssh_key=false.clone_and_checkoutregisters a git2 credentials callback only when a key is present → libgit2 fails with exactly that error.Fix: gate flake-job eligibility on the
fetchcapability when the job carriesFetchFlake, symmetric with credential delivery.WorkerBuildCaps→WorkerCapscarries thefetchflag from the negotiatedGradientCapabilities.Fixes #252.
Part 2 — Adaptive fetch/eval split
Builds on the capability gate to free scarce fetch workers. When an idle dedicated eval-only worker is connected, a flake eval is split:
[FetchFlake],Repository) runs on a fetch worker, archives the source and pushes its NAR to the cache;evaluation.flake_sourceand enqueues a cached eval follow-up ([EvaluateFlake, EvaluateDerivations],FlakeSource::Cached) that any eval worker runs, substituting the source NAR from the cache first.When no idle eval-only worker exists, the original bundled fetch+eval job is dispatched unchanged. A
ReserveFetchWorkersRulescoring penalty steers fetch workers away from cached-eval jobs (a soft steer, not a ban — no starvation).Tests
TDD throughout (
cargo test -p scheduler --lib,-p worker --lib):worker_pool:idle_eval_only_worker_detected,draining_eval_only_worker_does_not_countjobs:fetch_flake_job_requires_fetch_capability,cached_eval_job_runs_without_fetch_capability,is_fetch_only_*,cached_followup_rewrites_source_and_tasksscheduler_tests:fetch_only_completion_enqueues_cached_eval_followuppolicy:reserve_rule_penalizes_fetch_worker_for_cached_eval_onlyworker eval:cached_source_requires_store_path_presentDocs updated:
docs/src/tests.md,docs/src/scheduler.md.Follow-up ideas (not in this PR)
has_idle_eval_only_worker() && has_fetch_worker()).warn!when a fetch-only job's source NAR push fails (it's load-bearing for the follow-up's substitution).