hive-c0re: finish chrono-clock migration

This commit is contained in:
damocles 2026-08-01 23:55:00 +02:00 committed by mara
commit 9293c5d580
14 changed files with 82 additions and 78 deletions

View file

@ -44,7 +44,6 @@ use hive_host_sock::jobs::NodeView;
use hive_jobq::resources::ResourceTable;
use hive_jobq::scheduler::{Outcome, Scheduler};
use hive_jobq::{Dep, Graph, NodeId};
use hive_sh4re::wire_time::now_unix;
use tokio::sync::Notify;
pub use hive_jobq::TerminalState;
@ -107,7 +106,7 @@ struct NodeRuntime {
struct DagMeta {
source: Source,
reason: String,
created_at: i64,
created_at: DateTime<Utc>,
}
/// The mutable queue state behind the mutex: the crate scheduler plus the
@ -230,7 +229,7 @@ impl JobQueue {
NodeKind::Dag {
source: spec.source,
reason: spec.reason,
created_at: now_unix(),
created_at: Utc::now(),
},
Vec::new(),
None,
@ -469,9 +468,7 @@ impl JobQueue {
// `started_at` is set when a node enters `Running`, and this
// only sees `Running` nodes — the fallback is unreachable in
// practice, and "just now" is the honest answer if it isn't.
since: n
.started_at
.unwrap_or_else(|| hive_sh4re::wire_time::from_secs(now_unix())),
since: n.started_at.unwrap_or_else(Utc::now),
})
})
.collect()
@ -628,7 +625,7 @@ impl QueueInner {
id: container.get(),
source: meta.source,
reason: meta.reason.clone(),
created_at: hive_sh4re::wire_time::from_secs(meta.created_at),
created_at: meta.created_at,
started_at: started.into_iter().min(),
finished_at: is_terminal.then(|| finished.into_iter().max()).flatten(),
nodes,

View file

@ -12,6 +12,7 @@
//! DAG can span agents). See `docs/coordinator.md::Job queue` for the
//! full design.
use chrono::{DateTime, Utc};
pub use hive_host_sock::jobs::{DagView, NodeId, PermPayload, Source, State};
use serde::Serialize;
@ -283,7 +284,7 @@ pub enum NodeKind {
Dag {
source: Source,
reason: String,
created_at: i64,
created_at: DateTime<Utc>,
},
}