hive-c0re/hivectl/hive-agent: pause as a job-queue DAG node (closes #3056)
This commit is contained in:
parent
a92f7351d9
commit
20a7a21053
13 changed files with 316 additions and 27 deletions
|
|
@ -327,3 +327,31 @@ pub async fn stop_many(
|
|||
coord.emit_rebuild_queue_snapshot();
|
||||
Ok(ids)
|
||||
}
|
||||
|
||||
/// Declare the pause DAG for `agents` — one `PauseSignal → PauseDrain`
|
||||
/// pair (see [`super::templates::pause_quiesce`]) per agent, independent
|
||||
/// roots on their own agent lease so a whole-hive pause overlaps rather
|
||||
/// than serialising.
|
||||
pub(crate) fn pause_nodes(builder: &JobBuilder, agents: &[String]) -> Vec<hive_jobq::NodeGuid> {
|
||||
agents
|
||||
.iter()
|
||||
.map(|agent| super::templates::pause_quiesce(builder, agent).guid())
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Pause `agents` in a **single** DAG. Unlike `stop`/`start`/`restart`,
|
||||
/// this needs no live-state read first — `Coordinator::set_paused`
|
||||
/// works on a stopped container too (the marker is sticky), so there's
|
||||
/// no `running`/`stale` branch to resolve async before building.
|
||||
///
|
||||
/// # Errors
|
||||
/// Propagates a graph-insert error.
|
||||
pub async fn pause_many(
|
||||
coord: &Arc<Coordinator>,
|
||||
agents: &[String],
|
||||
) -> anyhow::Result<Vec<NodeId>> {
|
||||
let targets: Vec<String> = agents.to_vec();
|
||||
let ids = coord.job_queue.insert_job(|b| pause_nodes(b, &targets))?;
|
||||
coord.emit_rebuild_queue_snapshot();
|
||||
Ok(ids)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue