wip(#3001): remove submit layer, rescue power ops into job_queue/power.rs
TREE IS RED ON PURPOSE — there is no compiling intermediate between
deleting submit and converting every caller. Checkpoint commit so the
work is durable; do not "fix" it by restoring submit.
Done:
- JobQueue::submit -> JobQueue::insert (no source/reason/container;
returns the ids insert_job names).
- submit.rs deleted. Its 6 pure chain builders + 3 async *_many
gatherers were NOT wrapper code and are rescued into
job_queue/power.rs (templates.rs documents power ops as living
outside it, because their shape needs a live is_running read).
- Converted: meta_inputs 1, topology 2, permissions 3, auto_update 2,
actions 3, lifecycle_handlers 3.
- Dropped source/reason at every converted site: nothing ever read
NodeKind::Dag's fields (only `{ .. }` matches exist), so they are
write-only. Dead reason-only locals deleted; the boot sweep's summary
became a tracing::info! rather than being lost.
Remaining: dashboard/lifecycle_ops 7, server.rs 7, and the test suite —
tests.rs has its own submit() helper whose u64 return is used as the
handle to navigate the inserted DAG, so those need a different way to
find nodes, not a mechanical port.
This commit is contained in:
parent
6f87821110
commit
7c0d9d2379
9 changed files with 198 additions and 301 deletions
|
|
@ -36,17 +36,17 @@ fn rebuild(builder: &JobBuilder, agent: &str) {
|
|||
/// Restart shape with every agent treated as **running** — the online
|
||||
/// shape (`[Signal→Drain→] StopForUpdate → Reconcile`, no `SetWanted` head)
|
||||
/// most queue-mechanics tests assume. Mirrors the pre-dynamic
|
||||
/// `templates::restart` (which is now the state-aware `submit::restart_nodes`).
|
||||
/// `templates::restart` (which is now the state-aware `power::restart_nodes`).
|
||||
fn restart_online(builder: &JobBuilder, agents: &[&str], graceful: bool) {
|
||||
let targets: Vec<(String, bool)> = agents.iter().map(|a| ((*a).to_owned(), true)).collect();
|
||||
submit::restart_nodes(builder, &targets, graceful);
|
||||
power::restart_nodes(builder, &targets, graceful);
|
||||
}
|
||||
|
||||
/// Stop shape with every agent treated as **running** — the online shape
|
||||
/// (`SetWanted → [Signal→Drain→](graceful) Reconcile`).
|
||||
fn stop_online(builder: &JobBuilder, agents: &[&str], graceful: bool) {
|
||||
let targets: Vec<(String, bool)> = agents.iter().map(|a| ((*a).to_owned(), true)).collect();
|
||||
submit::stop_nodes(builder, &targets, graceful);
|
||||
power::stop_nodes(builder, &targets, graceful);
|
||||
}
|
||||
|
||||
// `Claimed` / `ClaimReady` / `CompleteNode` lived here: a claim snapshot type
|
||||
|
|
@ -682,7 +682,7 @@ fn multi_agent_start_one_dag_folds_per_agent_stale_rebuild() {
|
|||
// fresh: offline + not stale → SetWanted → Reconcile.
|
||||
// stale: offline + stale → SetWanted → «rebuild subgraph».
|
||||
let id = submit(&q, "hive-wide start", |builder| {
|
||||
submit::start_nodes(
|
||||
power::start_nodes(
|
||||
builder,
|
||||
&[
|
||||
("fresh".to_owned(), false, false),
|
||||
|
|
@ -742,13 +742,13 @@ fn offline_agents_skip_mechanical_nodes_but_keep_reconcile() {
|
|||
let q = JobQueue::new(4);
|
||||
// Offline graceful stop → SetWanted(Off) → Reconcile (no Signal/Drain).
|
||||
let stop = submit(&q, "stop down", |builder| {
|
||||
submit::stop_nodes(builder, &[("down".to_owned(), false)], true);
|
||||
power::stop_nodes(builder, &[("down".to_owned(), false)], true);
|
||||
});
|
||||
// Offline restart → a lone Reconcile (no SetWanted, no StopForUpdate):
|
||||
// nothing to bounce, and restart never rewrites intent, so the tail
|
||||
// Reconcile converges the down agent to its existing `wanted`.
|
||||
let restart = submit(&q, "restart down", |builder| {
|
||||
submit::restart_nodes(builder, &[("down2".to_owned(), false)], true);
|
||||
power::restart_nodes(builder, &[("down2".to_owned(), false)], true);
|
||||
});
|
||||
let shape = |id: u64| -> Vec<String> {
|
||||
// The group's work nodes: its subtree minus the container itself,
|
||||
|
|
@ -1153,19 +1153,19 @@ fn cancelled_power_op_runs_no_compensating_node() {
|
|||
|
||||
let q = JobQueue::new(1);
|
||||
let id = submit(&q, "bounce", |builder| {
|
||||
submit::restart_nodes(builder, &targets, graceful);
|
||||
power::restart_nodes(builder, &targets, graceful);
|
||||
});
|
||||
assert_cancels_clean(&q, id, false, &format!("restart {case}"));
|
||||
|
||||
let q = JobQueue::new(1);
|
||||
let id = submit(&q, "stop", |builder| {
|
||||
submit::stop_nodes(builder, &targets, graceful);
|
||||
power::stop_nodes(builder, &targets, graceful);
|
||||
});
|
||||
assert_cancels_clean(&q, id, true, &format!("stop {case}"));
|
||||
|
||||
let q = JobQueue::new(1);
|
||||
let id = submit(&q, "start", |builder| {
|
||||
submit::start_nodes(builder, &[("agent-a".to_owned(), running, false)]);
|
||||
power::start_nodes(builder, &[("agent-a".to_owned(), running, false)]);
|
||||
});
|
||||
assert_cancels_clean(&q, id, true, &format!("start {case}"));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue