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
|
|
@ -162,6 +162,14 @@ pub struct Coordinator {
|
|||
/// agent is in this set — the inbound fence. Cleared when the agent
|
||||
/// reports `GracefulStopComplete` or the container is stopped.
|
||||
graceful_stop_pending: Mutex<HashSet<String>>,
|
||||
/// Agents with a pause acknowledgement in progress — set by the pause
|
||||
/// DAG's signal node, cleared when the agent reports
|
||||
/// `PauseAcknowledged` (or the drain node's timeout fallback fires).
|
||||
/// Same shape as `graceful_stop_pending`, one set per concern rather
|
||||
/// than reusing it: a pause and a graceful stop are independent
|
||||
/// orchestrations that can be in flight for different agents
|
||||
/// simultaneously.
|
||||
pause_pending: Mutex<HashSet<String>>,
|
||||
/// Logical agent names that were running at the last broad-scope
|
||||
/// `hivectl stop`. A subsequent broad-scope `hivectl start` restores
|
||||
/// only this set (intersected with the requested scope) rather than
|
||||
|
|
@ -582,6 +590,7 @@ impl Coordinator {
|
|||
recent_transient: Mutex::new(HashMap::new()),
|
||||
recent_crashes: Mutex::new(HashMap::new()),
|
||||
graceful_stop_pending: Mutex::new(HashSet::new()),
|
||||
pause_pending: Mutex::new(HashSet::new()),
|
||||
last_stopped_running: Mutex::new(None),
|
||||
dashboard_events,
|
||||
event_seq: AtomicU64::new(0),
|
||||
|
|
@ -1188,6 +1197,26 @@ impl Coordinator {
|
|||
self.graceful_stop_pending.lock().unwrap().remove(name);
|
||||
}
|
||||
|
||||
/// Mark `name` as having a pause acknowledgement in progress. Set by
|
||||
/// the pause DAG's signal node; the drain node polls
|
||||
/// `is_pause_pending` until the agent reports back or the timeout
|
||||
/// fallback fires.
|
||||
pub fn mark_pause_pending(&self, name: &str) {
|
||||
self.pause_pending.lock().unwrap().insert(name.to_owned());
|
||||
}
|
||||
|
||||
/// Whether a pause acknowledgement is pending for `name`.
|
||||
#[must_use]
|
||||
pub fn is_pause_pending(&self, name: &str) -> bool {
|
||||
self.pause_pending.lock().unwrap().contains(name)
|
||||
}
|
||||
|
||||
/// Clear the pause-pending flag for `name` (agent reported
|
||||
/// `PauseAcknowledged`, or the drain node's wait finished / timed out).
|
||||
pub fn clear_pause_pending(&self, name: &str) {
|
||||
self.pause_pending.lock().unwrap().remove(name);
|
||||
}
|
||||
|
||||
/// Record the set of agents that were running at a broad-scope
|
||||
/// `hivectl stop`, so the next broad-scope `start` restores exactly
|
||||
/// this set. See the `last_stopped_running` field doc. Persists a
|
||||
|
|
|
|||
Loading…
Reference in a new issue