Rechner aus dem Pool nehmen: von Hand und als Wartung im Zeitplan

- Außerhalb des Pools: keine neuen Anfragen, nichts wird geladen; laufende
  Anfragen enden, danach entlädt der Proxy die Modelle; Pins ruhen
- Von Hand: Tabelle pool_out, POST /omega/api/nodes/{name}/pool, CLI pool out/in/list,
  Knöpfe auf Sparks & Modelle
- Geplant: Zeitplanart Wartung (Kind::Maintenance); Pins in einer Wartung sind ein Konflikt
- Modelle nur auf Rechnern außerhalb des Pools: 503 mit Grund, nicht in den Modelllisten
- Audit: node.out, node.in, maintenance.start, maintenance.end
- tests/multispark/pool_test.py

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Stephan RehfeldandClaude Opus 5.5 committed 2026-11-21 09:04:21 +01:00
1 parent 55116414e3
commit 18567382ef
13 files changed
+542 -28

No files matched your search

+38 -1
View File
@@ -12,7 +12,7 @@ use crate::{
accounts::{Actor, Group, Role, Session, User},
config::RecordingConfig,
dashboard::{HourUsage, Periods},
db::{ApiKey, Db, Scope},
db::{ApiKey, Db, PoolOut, Scope},
engines::{self, Engine},
quota::{Limits, Period, Quota},
recording::{Recording, Vault},
@@ -292,6 +292,11 @@ pub enum ScheduleInput {
#[serde(flatten)]
time: TimeInput,
},
Maintenance {
node: String,
#[serde(flatten)]
time: TimeInput,
},
}
#[derive(Serialize)]
@@ -849,6 +854,12 @@ impl<'a> Service<'a> {
(Kind::Exclusive { keys: keys.clone(), users, groups }, time)
}
ScheduleInput::Window { models, time } => (Kind::Window { models: checked_models(sched, models)? }, time),
ScheduleInput::Maintenance { node, time } => {
if sched.node_index(node).is_none() {
return Err(not_found(format!("unbekannter Rechner {node}")));
}
(Kind::Maintenance { node: node.clone() }, time)
}
};
Ok(Entry { id: 0, kind, time: time.spec(now)?, note: time.note.clone(), created_by: self.my_id() })
}
@@ -861,6 +872,32 @@ impl<'a> Service<'a> {
Ok(())
}
// Rechner aus dem Pool nehmen (Administratoren)
pub fn take_out_of_pool(&self, nodes: &[String], node: &str, reason: &str) -> Result<()> {
self.actor.require(Role::Admin).context("Rechner nehmen Administratoren aus dem Pool")?;
if !nodes.iter().any(|n| n == node) {
return Err(not_found(format!("unbekannter Rechner {node}")));
}
self.db.pool_out(self.who(), node, reason.trim())
}
pub fn return_to_pool(&self, nodes: &[String], node: &str) -> Result<()> {
self.actor.require(Role::Admin).context("Rechner nehmen Administratoren wieder auf")?;
if !nodes.iter().any(|n| n == node) {
return Err(not_found(format!("unbekannter Rechner {node}")));
}
if !self.db.pool_in(self.who(), node)? {
return Err(invalid(format!("{node} ist nicht von Hand aus dem Pool genommen")));
}
Ok(())
}
pub fn pool_list(&self) -> Result<Vec<PoolOut>> {
self.actor.require(Role::Admin)?;
self.db.pool_out_list()
}
// Aufzeichnungen: privat, nur der Inhaber des Keys
fn me(&self) -> Result<&User> {