Skip to content

Commit bdc7160

Browse files
committed
add omdb interpretation for blueprint_rendezvous task
1 parent a713a5a commit bdc7160

File tree

2 files changed

+56
-1
lines changed

2 files changed

+56
-1
lines changed

Diff for: dev-tools/omdb/src/bin/omdb/nexus.rs

+51
Original file line numberDiff line numberDiff line change
@@ -891,6 +891,9 @@ fn print_task_details(bgtask: &BackgroundTask, details: &serde_json::Value) {
891891
"blueprint_loader" => {
892892
print_task_blueprint_loader(details);
893893
}
894+
"blueprint_rendezvous" => {
895+
print_task_blueprint_rendezvous(details);
896+
}
894897
"dns_config_external" | "dns_config_internal" => {
895898
print_task_dns_config(details);
896899
}
@@ -1112,6 +1115,54 @@ fn print_task_blueprint_loader(details: &serde_json::Value) {
11121115
}
11131116
}
11141117

1118+
fn print_task_blueprint_rendezvous(details: &serde_json::Value) {
1119+
#[derive(Deserialize)]
1120+
struct CrucibleDatasetStats {
1121+
num_inserted: usize,
1122+
num_already_exist: usize,
1123+
num_not_in_inventory: usize,
1124+
}
1125+
1126+
#[derive(Deserialize)]
1127+
struct Stats {
1128+
crucible_dataset: CrucibleDatasetStats,
1129+
}
1130+
1131+
#[derive(Deserialize)]
1132+
struct BlueprintRendezvousStatus {
1133+
blueprint_id: Uuid,
1134+
inventory_collection_id: Uuid,
1135+
stats: Stats,
1136+
}
1137+
1138+
match serde_json::from_value::<BlueprintRendezvousStatus>(details.clone()) {
1139+
Err(error) => eprintln!(
1140+
"warning: failed to interpret task details: {:?}: {:?}",
1141+
error, details
1142+
),
1143+
Ok(status) => {
1144+
println!(" target blueprint: {}", status.blueprint_id);
1145+
println!(
1146+
" inventory collection: {}",
1147+
status.inventory_collection_id
1148+
);
1149+
println!(" crucible_dataset rendezvous counts:");
1150+
println!(
1151+
" num_inserted: {}",
1152+
status.stats.crucible_dataset.num_inserted
1153+
);
1154+
println!(
1155+
" num_already_exist: {}",
1156+
status.stats.crucible_dataset.num_already_exist
1157+
);
1158+
println!(
1159+
" num_not_in_inventory: {}",
1160+
status.stats.crucible_dataset.num_not_in_inventory
1161+
);
1162+
}
1163+
}
1164+
}
1165+
11151166
fn print_task_dns_config(details: &serde_json::Value) {
11161167
// The "dns_config" tasks emit the generation number of the config that
11171168
// they read.

Diff for: nexus/src/app/background/tasks/blueprint_rendezvous.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,11 @@ impl BlueprintRendezvous {
9292

9393
// Return the result as a `serde_json::Value`
9494
match result {
95-
Ok(stats) => json!({ "stats": stats }),
95+
Ok(stats) => json!({
96+
"blueprint_id": blueprint.id,
97+
"inventory_collection_id": collection.id,
98+
"stats": stats,
99+
}),
96100
Err(err) => json!({ "error":
97101
format!("rendezvous reconciliation failed: {err:#}"),
98102
}),

0 commit comments

Comments
 (0)