Skip to content

Commit 7e5a65a

Browse files
authored
refactor: adopt current Planner selection API before the feature stack (#768)
* refactor: adopt costed Planner selection without legacy API adapters * test: verify exact process routing for uncertified Planner candidates * docs: remove redundant Planner selection contract * deps: pin Planner bounded HLL confidence model
1 parent d7a03e5 commit 7e5a65a

29 files changed

Lines changed: 771 additions & 1222 deletions

‎Cargo.lock‎

Lines changed: 14 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ asap_sketchlib = { git = "https://github.com/ProjectASAP/asap_sketchlib", branch
2020
[workspace.dependencies]
2121
# Keep Planner frontends, selection, and IR on the same immutable revision.
2222
# Alias upstream asap-types because this workspace also defines asap_types.
23-
planner-types = { package = "asap-types", git = "https://github.com/ProjectASAP/ASAPPlanner", rev = "10d93846f0ef9f06ab19e599701d699d9cdd15af" }
24-
asap-aware-mapping = { git = "https://github.com/ProjectASAP/ASAPPlanner", rev = "10d93846f0ef9f06ab19e599701d699d9cdd15af" }
25-
asap-frontend-promql = { git = "https://github.com/ProjectASAP/ASAPPlanner", rev = "10d93846f0ef9f06ab19e599701d699d9cdd15af" }
26-
asap-frontend-sql = { git = "https://github.com/ProjectASAP/ASAPPlanner", rev = "10d93846f0ef9f06ab19e599701d699d9cdd15af" }
23+
planner-types = { package = "asap-types", git = "https://github.com/ProjectASAP/ASAPPlanner", rev = "cd7e9e0f710816d49190dabd6c789359067a208f" }
24+
asap-aware-mapping = { git = "https://github.com/ProjectASAP/ASAPPlanner", rev = "cd7e9e0f710816d49190dabd6c789359067a208f" }
25+
asap-frontend-promql = { git = "https://github.com/ProjectASAP/ASAPPlanner", rev = "cd7e9e0f710816d49190dabd6c789359067a208f" }
26+
asap-frontend-sql = { git = "https://github.com/ProjectASAP/ASAPPlanner", rev = "cd7e9e0f710816d49190dabd6c789359067a208f" }
2727

2828
# Shared external deps (used by 2+ crates)
2929
serde = { version = "1.0", features = ["derive"] }

‎control_plane/src/main.rs‎

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -645,19 +645,20 @@ fn compile_physical_plan_request(
645645
)
646646
.map_err(|error| (StatusCode::UNPROCESSABLE_ENTITY, error.to_string().into()))?;
647647
let planner_selection_trace = compilation_request.planner_selection_trace.clone();
648-
let (manifests, alternatives) = physical::workload_cost::compile_candidates_for_pricing(
649-
candidates.clone(),
650-
environment.clone(),
651-
frontend,
652-
);
648+
let (manifests, candidate_evaluations) =
649+
physical::workload_cost::compile_candidates_for_pricing(
650+
candidates.clone(),
651+
environment.clone(),
652+
frontend,
653+
);
653654
let apply_timeout = Duration::from_millis(request.apply_timeout_ms);
654655
// Quote preparation enumerates feasible bindings; it does not select the
655656
// default warm candidate, which may be unavailable while exact is valid.
656657
if manifests_only {
657658
if manifests.is_empty() {
658659
return Err((
659660
StatusCode::UNPROCESSABLE_ENTITY,
660-
serde_json::json!({"status": "all_infeasible", "alternatives": alternatives,
661+
serde_json::json!({"status": "all_infeasible", "candidates": candidate_evaluations,
661662
"logical_selection": compilation_request.planner_selection_trace}),
662663
));
663664
}
@@ -666,7 +667,7 @@ fn compile_physical_plan_request(
666667
request.target_collector_ids,
667668
apply_timeout,
668669
request.runtime_adaptation_evidence,
669-
(manifests, alternatives, planner_selection_trace),
670+
(manifests, candidate_evaluations, planner_selection_trace),
670671
));
671672
}
672673
let compiled = match request.workload_cost_evidence {
@@ -688,7 +689,7 @@ fn compile_physical_plan_request(
688689
};
689690
let bundle = match compiled {
690691
Ok(bundle) => bundle,
691-
Err(physical::compiler::CompileError::Alternatives(report)) => {
692+
Err(physical::compiler::CompileError::Candidates(report)) => {
692693
return Err((StatusCode::UNPROCESSABLE_ENTITY, report))
693694
}
694695
Err(error) => return Err((StatusCode::UNPROCESSABLE_ENTITY, error.to_string().into())),
@@ -698,7 +699,7 @@ fn compile_physical_plan_request(
698699
request.target_collector_ids,
699700
apply_timeout,
700701
request.runtime_adaptation_evidence,
701-
(manifests, alternatives, planner_selection_trace),
702+
(manifests, candidate_evaluations, planner_selection_trace),
702703
))
703704
}
704705

@@ -735,9 +736,9 @@ fn workload_cost_manifests(
735736
}
736737
let explain = request.explain;
737738
match compile_physical_plan_request(request, true, frontend) {
738-
Ok((_, _, _, _, (manifests, alternatives, planner_selection_trace))) => {
739+
Ok((_, _, _, _, (manifests, candidates, planner_selection_trace))) => {
739740
if explain {
740-
Json(serde_json::json!({"manifests": manifests, "alternatives": alternatives, "logical_selection": planner_selection_trace}))
741+
Json(serde_json::json!({"manifests": manifests, "candidates": candidates, "logical_selection": planner_selection_trace}))
741742
.into_response()
742743
} else {
743744
Json(manifests).into_response()
@@ -866,12 +867,12 @@ mod api_tests {
866867
let manifests = body_json(response).await;
867868
if explain {
868869
assert_eq!(manifests["manifests"].as_array().unwrap().len(), 1);
869-
let alternatives = manifests["alternatives"].as_array().unwrap();
870-
assert_eq!(alternatives.len(), 2);
871-
assert_eq!(alternatives[0]["status"], "bind_failed");
872-
assert!(alternatives[0]["unavailable_reason"].is_string());
873-
assert_eq!(alternatives[1]["status"], "bound");
874-
assert!(alternatives[1]["physical_alternative_id"].is_string());
870+
let candidates = manifests["candidates"].as_array().unwrap();
871+
assert_eq!(candidates.len(), 2);
872+
assert_eq!(candidates[0]["status"], "bind_failed");
873+
assert!(candidates[0]["unavailable_reason"].is_string());
874+
assert_eq!(candidates[1]["status"], "bound");
875+
assert!(candidates[1]["physical_candidate_id"].is_string());
875876
assert!(!manifests["logical_selection"]
876877
.as_array()
877878
.unwrap()
@@ -889,8 +890,8 @@ mod api_tests {
889890
assert_eq!(response.headers()["content-type"], "application/json");
890891
let report = body_json(response).await;
891892
assert_eq!(report["status"], "all_infeasible");
892-
assert_eq!(report["alternatives"].as_array().unwrap().len(), 2);
893-
assert!(report["alternatives"]
893+
assert_eq!(report["candidates"].as_array().unwrap().len(), 2);
894+
assert!(report["candidates"]
894895
.as_array()
895896
.unwrap()
896897
.iter()

‎control_plane/src/physical/backend_stage.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Backend-facing projection of one planning cycle.
22
//!
33
//! These types are the input to [`crate::backend_plan::from_stage_config`] and
4-
//! to `emit::backend_wire`'s backend JSON builders. `PhysicalCompiler` builds
4+
//! to `emit::backend_wire`'s backend JSON builders. `PhysicalPlanCompiler` builds
55
//! them directly from the summaries ASAPPlanner selected.
66
//!
77
//! They are deliberately not `Serialize`/`Deserialize`: `SummaryFamilyType`

0 commit comments

Comments
 (0)