Skip to content

Commit

Permalink
status tool prints useful status
Browse files Browse the repository at this point in the history
  • Loading branch information
rescrv committed Dec 2, 2024
1 parent d935f35 commit 229b807
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
24 changes: 22 additions & 2 deletions rust/load/src/bin/chroma-load-status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,28 @@ async fn main() {
{
Ok(resp) => {
if resp.status().is_success() {
let status = resp.json::<chroma_load::rest::Status>().await;
println!("{:#?}", status);
let status = match resp.json::<chroma_load::rest::Status>().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 {}: {}",
Expand Down
1 change: 1 addition & 0 deletions rust/load/src/rest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<WorkloadSummary>,
pub data_sets: Vec<Description>,
pub workloads: Vec<serde_json::Value>,
Expand Down

0 comments on commit 229b807

Please sign in to comment.