Skip to content

Commit e300707

Browse files
committed
omdb support for planning reports
1 parent 8f30bd5 commit e300707

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

dev-tools/omdb/src/bin/omdb/nexus.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1258,11 +1258,12 @@ fn print_task_blueprint_planner(details: &serde_json::Value) {
12581258
but could not make it the target: {error}"
12591259
);
12601260
}
1261-
BlueprintPlannerStatus::Targeted { blueprint_id, .. } => {
1261+
BlueprintPlannerStatus::Targeted { blueprint_id, report, .. } => {
12621262
println!(
12631263
" planned new blueprint {blueprint_id}, \
12641264
and made it the current target"
12651265
);
1266+
println!("{report}");
12661267
}
12671268
}
12681269
}

nexus/src/app/background/tasks/blueprint_planner.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ impl BlueprintPlanner {
150150
));
151151
}
152152
};
153-
let blueprint = match planner.plan() {
153+
let (blueprint, report) = match planner.plan_and_report() {
154154
Ok(blueprint) => blueprint,
155155
Err(error) => {
156156
error!(&opctx.log, "can't plan: {error}");
@@ -241,7 +241,11 @@ impl BlueprintPlanner {
241241

242242
// We have a new target!
243243
self.tx_blueprint.send_replace(Some(Arc::new((target, blueprint))));
244-
BlueprintPlannerStatus::Targeted { parent_blueprint_id, blueprint_id }
244+
BlueprintPlannerStatus::Targeted {
245+
parent_blueprint_id,
246+
blueprint_id,
247+
report,
248+
}
245249
}
246250
}
247251

@@ -332,8 +336,10 @@ mod test {
332336
BlueprintPlannerStatus::Targeted {
333337
parent_blueprint_id,
334338
blueprint_id,
339+
report,
335340
} if parent_blueprint_id == initial_blueprint.id
336-
&& blueprint_id != initial_blueprint.id =>
341+
&& blueprint_id != initial_blueprint.id
342+
&& blueprint_id == report.blueprint_id =>
337343
{
338344
blueprint_id
339345
}

nexus/types/src/internal_api/background.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// License, v. 2.0. If a copy of the MPL was not distributed with this
33
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
44

5+
use crate::deployment::PlanningReport;
56
use crate::external_api::views;
67
use chrono::DateTime;
78
use chrono::Utc;
@@ -460,6 +461,7 @@ impl slog::KV for DebugDatasetsRendezvousStats {
460461
}
461462

462463
/// The status of a `blueprint_planner` background task activation.
464+
#[allow(clippy::large_enum_variant)]
463465
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
464466
pub enum BlueprintPlannerStatus {
465467
/// Automatic blueprint planning has been explicitly disabled
@@ -479,7 +481,11 @@ pub enum BlueprintPlannerStatus {
479481

480482
/// Planing succeeded, and we saved and made the new blueprint the
481483
/// current target.
482-
Targeted { parent_blueprint_id: BlueprintUuid, blueprint_id: BlueprintUuid },
484+
Targeted {
485+
parent_blueprint_id: BlueprintUuid,
486+
blueprint_id: BlueprintUuid,
487+
report: PlanningReport,
488+
},
483489
}
484490

485491
/// The status of a `alert_dispatcher` background task activation.

0 commit comments

Comments
 (0)