From cdbf0a98f876576270a4935a42642290392136d4 Mon Sep 17 00:00:00 2001 From: Robert Escriva Date: Mon, 2 Dec 2024 10:27:56 -0800 Subject: [PATCH] status tool prints useful status --- rust/load/src/bin/chroma-load-status.rs | 24 ++++++++++++++++++++++-- rust/load/src/rest.rs | 1 + 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/rust/load/src/bin/chroma-load-status.rs b/rust/load/src/bin/chroma-load-status.rs index 5e874a1e43d..fcf96ac4116 100644 --- a/rust/load/src/bin/chroma-load-status.rs +++ b/rust/load/src/bin/chroma-load-status.rs @@ -20,8 +20,28 @@ async fn main() { { Ok(resp) => { if resp.status().is_success() { - let status = resp.json::().await; - println!("{:#?}", status); + let status = match resp.json::().await { + Ok(status) => status, + Err(e) => { + eprintln!("Failed to fetch workload status on {}: {}", args.host, e); + return; + } + }; + if status.inhibited { + println!("inhibited"); + } else { + for running in status.running { + println!( + "{} {} {} {} {}", + running.uuid, + running.expires, + running.name, + running.data_set, + // SAFETY(rescrv): WorkloadSummary always converts to JSON. + serde_json::to_string(&running.workload).unwrap() + ); + } + } } else { eprintln!( "Failed to get workload status on {}: {}", diff --git a/rust/load/src/rest.rs b/rust/load/src/rest.rs index 966442c98d7..dfc19866691 100644 --- a/rust/load/src/rest.rs +++ b/rust/load/src/rest.rs @@ -21,6 +21,7 @@ impl From<&dyn crate::DataSet> for Description { #[derive(Clone, Debug, serde::Deserialize, serde::Serialize)] pub struct Status { + pub inhibited: bool, pub running: Vec, pub data_sets: Vec, pub workloads: Vec,