remove the hive dashboard's stats page and the price table behind it
The ST4TS page (/stats.html), GET /api/stats-hive, hive-c0re's hive_stats rollup and the modelPrices option that only fed its cost estimate are gone. Each agent's own /stats page and the turn-stats database it reads are unchanged. Setting modelPrices now fails evaluation with a message saying so.
This commit is contained in:
parent
1d3ab2fae5
commit
5e9a22cb38
1 changed files with 112 additions and 1207 deletions
|
|
@ -69,13 +69,6 @@ pub struct Coordinator {
|
|||
/// Same drop-in, same relative-share and `None` semantics as
|
||||
/// [`Self::agent_cpu_weight`].
|
||||
pub agent_io_weight: Option<u32>,
|
||||
/// Operator-tunable model→price table backing the hive-wide cost
|
||||
/// estimate on the ST4TS tab. Set via `services.hyperhive.modelPrices`
|
||||
/// and passed to `hive-c0re serve --model-prices <json>`. Models not
|
||||
/// in the table fall back to the built-in estimate in `hive_stats`.
|
||||
/// hive-c0re-local (read only by the `/api/stats-hive` handler), so it
|
||||
/// is *not* part of `HiveEnv` and is never injected into containers.
|
||||
pub model_prices: crate::hive_stats::PriceTable,
|
||||
agents: Mutex<HashMap<String, AgentSocket>>,
|
||||
/// Tombstone for transients that have JUST been cleared. The
|
||||
/// crash watcher polls every 10s and would race the
|
||||
|
|
@ -215,9 +208,9 @@ impl Default for HiveEnv {
|
|||
|
||||
/// On-disk shape of the `hive-c0re serve --config <file>` JSON: the
|
||||
/// container-injected [`HiveEnv`] (flattened) plus the hive-c0re-local
|
||||
/// `model_prices` table (read only by the `/api/stats-hive` handler, never
|
||||
/// injected into containers — hence kept out of `HiveEnv`). The NixOS
|
||||
/// module writes this so the `ExecStart` carries one `--config` flag
|
||||
/// settings that are never injected into containers — hence kept out of
|
||||
/// `HiveEnv`. The NixOS module writes this so the `ExecStart` carries one
|
||||
/// `--config` flag
|
||||
/// instead of every host-level setting as its own JSON-blob argument.
|
||||
/// `#[serde(default)]` lets any field be omitted and fall back to its
|
||||
/// canonical default.
|
||||
|
|
@ -226,10 +219,9 @@ impl Default for HiveEnv {
|
|||
pub struct ServeConfig {
|
||||
#[serde(flatten)]
|
||||
pub env: HiveEnv,
|
||||
pub model_prices: crate::hive_stats::PriceTable,
|
||||
/// Number of concurrent closure-fetching job-queue nodes (prebuild /
|
||||
/// profile-swap / create / meta lock). hive-c0re-local like
|
||||
/// `model_prices` — never injected into containers. Set via
|
||||
/// profile-swap / create / meta lock). hive-c0re-local — never
|
||||
/// injected into containers. Set via
|
||||
/// `services.hyperhive.deploy.hive-controller.buildSlots`.
|
||||
pub build_slots: usize,
|
||||
}
|
||||
|
|
@ -238,7 +230,6 @@ impl Default for ServeConfig {
|
|||
fn default() -> Self {
|
||||
Self {
|
||||
env: HiveEnv::default(),
|
||||
model_prices: crate::hive_stats::PriceTable::default(),
|
||||
build_slots: 1,
|
||||
}
|
||||
}
|
||||
|
|
@ -250,16 +241,14 @@ mod serve_config_tests {
|
|||
|
||||
#[test]
|
||||
fn deserialises_flat_with_per_field_defaults() {
|
||||
// The flattened HiveEnv fields + the local model_prices all live at
|
||||
// The flattened HiveEnv fields + the local build_slots all live at
|
||||
// the JSON top level. Present fields are read; omitted ones fall
|
||||
// back to their canonical defaults (so a partial config is valid).
|
||||
let sc: ServeConfig = serde_json::from_str(
|
||||
r#"{
|
||||
"hyperhive_flake": "/x",
|
||||
"dashboard_port": 1234,
|
||||
"model_prices": {
|
||||
"opus": {"input": 5.0, "output": 25.0, "cache_read": 0.5, "cache_write": 10.0}
|
||||
}
|
||||
"build_slots": 3
|
||||
}"#,
|
||||
)
|
||||
.expect("flat ServeConfig should deserialise");
|
||||
|
|
@ -267,7 +256,15 @@ mod serve_config_tests {
|
|||
assert_eq!(sc.env.dashboard_port, 1234);
|
||||
// omitted → HiveEnv::default()
|
||||
assert_eq!(sc.env.agent_cpu_quota, "200%");
|
||||
assert!(sc.model_prices.contains_key("opus"));
|
||||
assert_eq!(sc.build_slots, 3);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_leftover_model_prices_key_is_ignored() {
|
||||
// Configs written before the hive stats page went carry the key.
|
||||
let sc: ServeConfig = serde_json::from_str(r#"{"model_prices": {"opus": {"input": 5.0}}}"#)
|
||||
.expect("an unknown key must not break startup");
|
||||
assert_eq!(sc.build_slots, 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -275,7 +272,7 @@ mod serve_config_tests {
|
|||
let sc: ServeConfig = serde_json::from_str("{}").expect("empty config valid");
|
||||
assert_eq!(sc.env.dashboard_port, 7000);
|
||||
assert_eq!(sc.env.hyperhive_flake, "/etc/hyperhive");
|
||||
assert!(sc.model_prices.is_empty());
|
||||
assert_eq!(sc.build_slots, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -336,12 +333,7 @@ impl std::fmt::Display for SetPausedByNameError {
|
|||
}
|
||||
|
||||
impl Coordinator {
|
||||
pub fn open(
|
||||
db_path: &Path,
|
||||
env: HiveEnv,
|
||||
model_prices: crate::hive_stats::PriceTable,
|
||||
build_slots: usize,
|
||||
) -> Result<Self> {
|
||||
pub fn open(db_path: &Path, env: HiveEnv, build_slots: usize) -> Result<Self> {
|
||||
let HiveEnv {
|
||||
hyperhive_flake,
|
||||
claude_code_path,
|
||||
|
|
@ -386,7 +378,6 @@ impl Coordinator {
|
|||
agent_memory_max,
|
||||
agent_cpu_weight,
|
||||
agent_io_weight,
|
||||
model_prices,
|
||||
agents: Mutex::new(HashMap::new()),
|
||||
recent_transient: Mutex::new(HashMap::new()),
|
||||
graceful_stop_pending: Mutex::new(HashSet::new()),
|
||||
|
|
@ -1072,13 +1063,7 @@ mod open_tests {
|
|||
use super::{Coordinator, HiveEnv};
|
||||
|
||||
fn open(db: &std::path::Path) -> Coordinator {
|
||||
Coordinator::open(
|
||||
db,
|
||||
HiveEnv::default(),
|
||||
crate::hive_stats::PriceTable::new(),
|
||||
1,
|
||||
)
|
||||
.expect("open coordinator")
|
||||
Coordinator::open(db, HiveEnv::default(), 1).expect("open coordinator")
|
||||
}
|
||||
|
||||
/// A build log row the previous process left open is closed as failed
|
||||
|
|
|
|||
Loading…
Reference in a new issue