Commit 4030c68
make get_input_drvs return relation for dynamic inputs
wip
Add dynamic derivation resolution
Do dynamic derivation resolution, still doesn't splice tree
Revert "Do dynamic derivation resolution, still doesn't splice tree"
This reverts commit 389cc05.
Simpler initial dynamic resolution
dynamic dep prototype, needs testing
Remove dynamic_deps, we can store relation in dynamic_rdeps instead
enable dyn-drv test
Let Claude fix dynamic derivation building in queue runner
This was basically unsupervised, except for me running the test and
feeding it the test logs.
Four bugs prevented dynamic derivations from being built:
- `get_dependents` only walked `rdeps`, not `dynamic_rdeps`, so steps
connected via dynamic dependencies appeared orphaned and were
"maybe cancelled" instead of dispatched.
- `succeed_step` used `get_direct_builds` to find the owning build for
dynamic rdeps processing. Intermediate steps (like `hello.drv.drv`)
have no direct builds, so we now fall back to `get_dependents` to
walk the dependency chain.
- `make_rdeps_runnable` only processed `rdeps`, never removing the
finished step from `dynamic_rdeps` dependents' forward `deps`. This
left the wrapper permanently stuck with an unsatisfied dependency.
- `resolve_dynamic_input` used `1..outputs.len()` which produces an
empty range for single-element chains (the common case). Changed to
`1..=outputs.len()` so the chain is actually resolved and the
produced `.drv` file is discovered and built as a new step.
Test updated from 2 to 5 expected build steps now that Hydra properly
tracks the full dynamic derivation chain.
Combine `rdeps` and `dynamic_rdeps` into a single `rdeps` list
Both were reverse dependency lists differing only in whether they
carried a `relation` (output name chain for dynamic derivations). Having
two separate lists meant every operation that walked one had to remember
to also walk the other — the exact class of bug fixed in the previous
commit.
Now `StepState::rdeps` is `Vec<ReverseDep>` where an empty `relation`
signifies a regular (non-dynamic) reverse dependency. `get_dependents`,
`make_rdeps_runnable`, and `add_referring_data` all operate on the
single unified list. The `dynamic_rdeps_len` atomic counter,
`clone_dyn_rdeps` method, and `DynamicReverseDep` type are removed in
favor of the renamed `ReverseDep`.
Resolve dynamic derivation chains one level at a time
Instead of resolving the entire chain at once via a recursive SQL query
in `resolve_dynamic_input`, resolve one level per step completion: when
a step finishes, `pop_dynamic_rdeps` pops the next output name from the
relation stack, and `succeed_step` looks it up directly in the build
output — no DB round-trip needed.
The relation vector is now stored in reverse order so that `pop()` gives
the next level to resolve in O(1).
`resolve_dynamic_input` is removed from both `State` and
`db::Connection` since it is no longer needed. The `create_step` input
processing no longer attempts eager resolution either; the dynamic rdeps
mechanism in `succeed_step` handles it naturally as each step completes.
TEMP add some asserts, see failure
Fix CA resolution for intermediate steps, extract `DynDrvRelation` type
Three changes:
- **Fix premature build completion**: `realise_drv_on_valid_machine`
passed `referring_build: Some(build)` when creating resolved steps for
ALL CA derivations, not just the toplevel. This caused `succeed_step`
to mark the entire build as finished when an intermediate resolved
step completed (e.g. resolved `build-b`), orphaning downstream steps
(d, e, wrapper). Now `referring_build` is only set when the unresolved
step was the build's toplevel.
- **`DynDrvRelation` newtype**: Extracts the reversed output-name stack
into its own type, documenting the reversal invariant in the type name
and providing `is_empty()`/`pop()` methods. Used throughout `ReverseDep`,
`add_referring_data`, `create_step`, and `pop_dynamic_rdeps`.
- **`input_drvs` free function**: Walks `SingleDerivedPath` directly
instead of going through `DerivationInputs::from`. Skips `Opaque`
(source) inputs — only `Built` derivation dependencies are returned.
The outermost output name (what we consume) is discarded; intermediate
names form the `DynDrvRelation`. Called inline in `create_step` before
`set_drv` consumes the derivation.
Non-trivial dyn-drv test now expects 12 build steps covering the full
chain: makeDerivations → a → b,c (resolve+build) → d (resolve+build) →
e (resolve+build) → wrapper (resolve+build).
Extract `state::drv` module with `OutputNameChain` and `SingleDerivedPath` helpers
Move `OutputNameChain` (renamed from `DynDrvRelation`), `input_drvs`,
and `flatten_chain` into a new `state::drv` module. Add `flatten_path`
as the base case for mutual recursion with `flatten_chain`.
`flatten_path`/`flatten_chain` now return `OutputNameChain` directly in
stack order (outermost first), eliminating the separate reverse step.
`input_drvs` calls `flatten_path` on the inner `drv_path` of each
`Built` input, naturally discarding the outermost output name.
`flatten_chain` (previously in `step_info.rs`) and `input_drvs`
(previously in `step.rs`) are unified in one place. The SQL caller in
`step_info.rs` reverses to forward order where needed.1 parent 7c69e41 commit 4030c68
5 files changed
Lines changed: 240 additions & 70 deletions
File tree
- subprojects
- hydra-queue-runner/src/state
- hydra-tests/content-addressed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
3 | 5 | | |
| |||
42 | 44 | | |
43 | 45 | | |
44 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
510 | 510 | | |
511 | 511 | | |
512 | 512 | | |
513 | | - | |
| 513 | + | |
514 | 514 | | |
515 | 515 | | |
516 | 516 | | |
| |||
1377 | 1377 | | |
1378 | 1378 | | |
1379 | 1379 | | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
1380 | 1448 | | |
1381 | 1449 | | |
1382 | 1450 | | |
| |||
1922 | 1990 | | |
1923 | 1991 | | |
1924 | 1992 | | |
1925 | | - | |
| 1993 | + | |
1926 | 1994 | | |
1927 | 1995 | | |
1928 | 1996 | | |
| |||
1936 | 2004 | | |
1937 | 2005 | | |
1938 | 2006 | | |
1939 | | - | |
1940 | | - | |
1941 | | - | |
| 2007 | + | |
| 2008 | + | |
| 2009 | + | |
| 2010 | + | |
| 2011 | + | |
| 2012 | + | |
| 2013 | + | |
1942 | 2014 | | |
1943 | 2015 | | |
1944 | 2016 | | |
| |||
2034 | 2106 | | |
2035 | 2107 | | |
2036 | 2108 | | |
| 2109 | + | |
2037 | 2110 | | |
2038 | 2111 | | |
2039 | 2112 | | |
| |||
2091 | 2164 | | |
2092 | 2165 | | |
2093 | 2166 | | |
2094 | | - | |
2095 | | - | |
2096 | | - | |
2097 | | - | |
2098 | 2167 | | |
2099 | 2168 | | |
2100 | | - | |
2101 | | - | |
2102 | | - | |
2103 | | - | |
2104 | | - | |
2105 | | - | |
2106 | | - | |
2107 | | - | |
2108 | | - | |
2109 | | - | |
2110 | | - | |
2111 | | - | |
2112 | | - | |
2113 | | - | |
2114 | | - | |
2115 | | - | |
2116 | | - | |
2117 | | - | |
2118 | | - | |
2119 | | - | |
2120 | | - | |
2121 | | - | |
2122 | | - | |
| 2169 | + | |
| 2170 | + | |
| 2171 | + | |
| 2172 | + | |
| 2173 | + | |
| 2174 | + | |
| 2175 | + | |
| 2176 | + | |
| 2177 | + | |
| 2178 | + | |
| 2179 | + | |
| 2180 | + | |
| 2181 | + | |
| 2182 | + | |
| 2183 | + | |
| 2184 | + | |
| 2185 | + | |
| 2186 | + | |
| 2187 | + | |
| 2188 | + | |
| 2189 | + | |
| 2190 | + | |
| 2191 | + | |
| 2192 | + | |
2123 | 2193 | | |
2124 | 2194 | | |
2125 | 2195 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
11 | 20 | | |
12 | 21 | | |
13 | 22 | | |
| |||
66 | 75 | | |
67 | 76 | | |
68 | 77 | | |
69 | | - | |
| 78 | + | |
70 | 79 | | |
71 | 80 | | |
72 | | - | |
| 81 | + | |
| 82 | + | |
73 | 83 | | |
74 | 84 | | |
75 | 85 | | |
| |||
186 | 196 | | |
187 | 197 | | |
188 | 198 | | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
| |||
270 | 270 | | |
271 | 271 | | |
272 | 272 | | |
273 | | - | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
274 | 276 | | |
275 | 277 | | |
276 | 278 | | |
| |||
286 | 288 | | |
287 | 289 | | |
288 | 290 | | |
289 | | - | |
| 291 | + | |
290 | 292 | | |
291 | 293 | | |
292 | 294 | | |
| |||
374 | 376 | | |
375 | 377 | | |
376 | 378 | | |
377 | | - | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
378 | 383 | | |
379 | 384 | | |
380 | 385 | | |
381 | 386 | | |
382 | 387 | | |
383 | | - | |
| 388 | + | |
384 | 389 | | |
385 | 390 | | |
386 | 391 | | |
387 | 392 | | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
388 | 414 | | |
389 | 415 | | |
390 | 416 | | |
391 | | - | |
| 417 | + | |
392 | 418 | | |
393 | 419 | | |
394 | 420 | | |
| |||
398 | 424 | | |
399 | 425 | | |
400 | 426 | | |
401 | | - | |
402 | | - | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
403 | 432 | | |
404 | 433 | | |
405 | 434 | | |
| |||
531 | 560 | | |
532 | 561 | | |
533 | 562 | | |
534 | | - | |
| 563 | + | |
535 | 564 | | |
536 | 565 | | |
537 | 566 | | |
| |||
Lines changed: 32 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
42 | 74 | | |
43 | 75 | | |
44 | 76 | | |
0 commit comments