feat(#1184): make agent CPU quota and memory limit configurable
This commit is contained in:
parent
4f80253101
commit
d1fbb4aef8
7 changed files with 80 additions and 12 deletions
|
|
@ -73,6 +73,15 @@ enum Cmd {
|
|||
default_value = r#"{"haiku":200000,"sonnet":1000000,"opus":1000000}"#
|
||||
)]
|
||||
context_window_tokens: String,
|
||||
/// systemd `CPUQuota=` applied to every agent container via a drop-in.
|
||||
/// Expressed as a percentage of one CPU core (e.g. `"200%"` = 2 cores).
|
||||
/// Set via `services.hyperhive.agentCpuQuota`.
|
||||
#[arg(long, default_value = "200%")]
|
||||
agent_cpu_quota: String,
|
||||
/// systemd `MemoryMax=` applied to every agent container.
|
||||
/// Set via `services.hyperhive.agentMemoryMax`.
|
||||
#[arg(long, default_value = "4G")]
|
||||
agent_memory_max: String,
|
||||
},
|
||||
/// Spawn a new agent container directly (`hive-agent-<name>`). Bypasses
|
||||
/// the approval queue — use only as an operator on the host. For
|
||||
|
|
@ -141,6 +150,8 @@ async fn main() -> Result<()> {
|
|||
dashboard_port,
|
||||
operator_pronouns,
|
||||
context_window_tokens,
|
||||
agent_cpu_quota,
|
||||
agent_memory_max,
|
||||
} => {
|
||||
cmd_serve(
|
||||
hyperhive_flake,
|
||||
|
|
@ -150,6 +161,8 @@ async fn main() -> Result<()> {
|
|||
dashboard_port,
|
||||
operator_pronouns,
|
||||
context_window_tokens,
|
||||
agent_cpu_quota,
|
||||
agent_memory_max,
|
||||
&cli.socket,
|
||||
)
|
||||
.await
|
||||
|
|
@ -199,6 +212,8 @@ async fn cmd_serve(
|
|||
dashboard_port: u16,
|
||||
operator_pronouns: String,
|
||||
context_window_tokens: String,
|
||||
agent_cpu_quota: String,
|
||||
agent_memory_max: String,
|
||||
socket: &std::path::Path,
|
||||
) -> Result<()> {
|
||||
let cwt: std::collections::HashMap<String, u64> = serde_json::from_str(&context_window_tokens)
|
||||
|
|
@ -211,6 +226,8 @@ async fn cmd_serve(
|
|||
dashboard_port,
|
||||
operator_pronouns,
|
||||
cwt,
|
||||
agent_cpu_quota,
|
||||
agent_memory_max,
|
||||
)?);
|
||||
manager_server::start(coord.clone())?;
|
||||
// Idempotent pre-flight: rewrite pre-meta-layout applied
|
||||
|
|
|
|||
Loading…
Reference in a new issue