chore(neuron): log load_model failures server-side with full chain
The HTTP handler now emits a tracing::warn on load_model failures with
the expanded anyhow chain (format!("{e:#}")) before returning the 400.
journalctl -u neuron will surface the underlying hf-hub /
materialisation error without needing to capture the curl response
body separately.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -69,11 +69,22 @@ async fn load_model(
|
|||||||
let registry = state.registry.read().await;
|
let registry = state.registry.read().await;
|
||||||
match registry.load_model(&spec).await {
|
match registry.load_model(&spec).await {
|
||||||
Ok(()) => Json(json!({"status": "loaded"})).into_response(),
|
Ok(()) => Json(json!({"status": "loaded"})).into_response(),
|
||||||
Err(e) => (
|
Err(e) => {
|
||||||
StatusCode::BAD_REQUEST,
|
// Log the full anyhow chain server-side so journalctl shows
|
||||||
Json(json!({"error": format!("{e:#}")})),
|
// the underlying failure (hf-hub timeout, permission denied,
|
||||||
)
|
// disk full, etc.) without needing to inspect the HTTP
|
||||||
.into_response(),
|
// response body separately.
|
||||||
|
tracing::warn!(
|
||||||
|
model = %spec.model_id,
|
||||||
|
error = %format!("{e:#}"),
|
||||||
|
"load_model failed"
|
||||||
|
);
|
||||||
|
(
|
||||||
|
StatusCode::BAD_REQUEST,
|
||||||
|
Json(json!({"error": format!("{e:#}")})),
|
||||||
|
)
|
||||||
|
.into_response()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user