job_queue: the reconcile fan-out declares from templates
exec.rs's Reconcile arm was the one construction site declaring a resource inline in an executor rather than in templates.rs. It now calls templates::fanned_out_mechanical, which is where every other declaration lives -- construction sites state their own holdings. That also fixes a test which could not fail. The old one claimed a Reconcile and then re-declared the fan-out itself, commented "same two calls the scheduler makes, in the same order" -- a copy of production inside the test. Had exec.rs stopped declaring the lease, it would have kept passing. The replacement calls the real function and asserts the declaration, with no DAG run at all. The other half of the old test -- that a descendant re-enters its ancestor's grant instead of taking a second unit of a cap-1 lease -- is hive-jobq's, tested there by child_borrows_ancestor_grant_released_when_subtree_done and nested_borrowers_never_deadlock.
This commit is contained in:
parent
eab6bce813
commit
53cd010a12
3 changed files with 61 additions and 73 deletions
|
|
@ -80,6 +80,23 @@ fn resolve_approval_tails(b: &Job, approval_id: i64, root: Handle<'_>) {
|
|||
}
|
||||
}
|
||||
|
||||
/// Declare the mechanical node a [`NodeKind::Reconcile`] planner fans out
|
||||
/// (`Start` / `Stop`) onto the builder it was handed while running.
|
||||
///
|
||||
/// `Start` / `Stop` declare the agent lease they run under. Their `Reconcile`
|
||||
/// parent is holding it already, so the declaration is a **re-entrant borrow**
|
||||
/// — no second unit, no deadlock. It exists so the requirement belongs to the
|
||||
/// node rather than to the fact that a `Reconcile` happens to fan it out.
|
||||
///
|
||||
/// Lives here rather than inline in `exec.rs` for the same reason every other
|
||||
/// declaration does: this is the one construction site that was hiding in an
|
||||
/// executor, which meant the only test of it had to re-declare the same two
|
||||
/// calls itself and would have kept passing if the executor changed.
|
||||
pub(crate) fn fanned_out_mechanical(b: &Job, kind: NodeKind) {
|
||||
let lease = Resource::Agent(kind.agent().to_owned());
|
||||
let _ = b.node(kind).needs(lease);
|
||||
}
|
||||
|
||||
/// Knobs for [`rebuild_nodes`]. A struct rather than two positional `bool`s so
|
||||
/// a call site cannot silently swap them.
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
|
|
|
|||
Loading…
Reference in a new issue