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:
1 parent
55116414e3
commit
18567382ef
13 files changed
+542
-28
No files matched your search
+22
-9
@@ -268,7 +268,16 @@ async fn merged_list(st: &AppState, caller: &Caller, engine: Engine, path: &str,
|
||||
Ok(v) => v,
|
||||
Err(r) => return r,
|
||||
};
|
||||
let lists = join_all(st.sched.reachable_nodes_with(engine).into_iter().map(|node| async move {
|
||||
let nodes = st.sched.reachable_nodes_with(engine);
|
||||
// Sind alle Rechner mit dieser Engine aus dem Pool genommen, gibt es gerade keine Modelle.
|
||||
if nodes.is_empty() && st.sched.nodes_with(engine).into_iter().all(|i| st.sched.is_out_of_pool(i)) {
|
||||
let mut empty = json!({ field: [] });
|
||||
if field == "data" {
|
||||
empty["object"] = json!("list");
|
||||
}
|
||||
return Json(empty).into_response();
|
||||
}
|
||||
let lists = join_all(nodes.into_iter().map(|node| async move {
|
||||
let base = st.sched.engine_url(node, engine).expect("Engine konfiguriert");
|
||||
let request = st.http.get(format!("{base}{path}")).timeout(Duration::from_secs(10));
|
||||
match request.send().await {
|
||||
@@ -440,7 +449,7 @@ async fn handle(
|
||||
Ok(key) => key,
|
||||
Err(e) => {
|
||||
refund();
|
||||
return engine_error(engine, StatusCode::NOT_FOUND, &e.to_string());
|
||||
return engine_error(engine, sched_status(&e), &e.to_string());
|
||||
}
|
||||
};
|
||||
target = st.sched.model_url(&key);
|
||||
@@ -449,12 +458,7 @@ async fn handle(
|
||||
Ok(g) => guard = Some(g),
|
||||
Err(e) => {
|
||||
refund();
|
||||
let status = match e {
|
||||
SchedError::UnknownModel(_) => StatusCode::NOT_FOUND,
|
||||
SchedError::Timeout(_) => StatusCode::SERVICE_UNAVAILABLE,
|
||||
SchedError::LoadFailed(_) => StatusCode::BAD_GATEWAY,
|
||||
};
|
||||
return engine_error(engine, status, &e.to_string());
|
||||
return engine_error(engine, sched_status(&e), &e.to_string());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -490,7 +494,8 @@ async fn handle(
|
||||
return openai_error(StatusCode::BAD_REQUEST, "das Feld model fehlt");
|
||||
}
|
||||
let target = target.or_else(|| {
|
||||
let node = st.sched.nodes_with(engine).first().copied()?;
|
||||
// Lieber ein erreichbarer Rechner im Pool
|
||||
let node = st.sched.reachable_nodes_with(engine).first().or(st.sched.nodes_with(engine).first()).copied()?;
|
||||
st.sched.engine_url(node, engine).map(str::to_string)
|
||||
});
|
||||
let Some(base) = target else {
|
||||
@@ -538,3 +543,11 @@ async fn handle(
|
||||
let recorder = st.recorder.clone();
|
||||
forward(&st.http, db, Forward { method, url, headers, body, usage, guard, engine, record, capture, recorder }).await
|
||||
}
|
||||
|
||||
fn sched_status(e: &SchedError) -> StatusCode {
|
||||
match e {
|
||||
SchedError::UnknownModel(_) => StatusCode::NOT_FOUND,
|
||||
SchedError::Timeout(_) | SchedError::OutOfPool(_) => StatusCode::SERVICE_UNAVAILABLE,
|
||||
SchedError::LoadFailed(_) => StatusCode::BAD_GATEWAY,
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user