Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 14 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ asap_sketchlib = { git = "https://github.com/ProjectASAP/asap_sketchlib", branch
[workspace.dependencies]
# Keep Planner frontends, selection, and IR on the same immutable revision.
# Alias upstream asap-types because this workspace also defines asap_types.
planner-types = { package = "asap-types", git = "https://github.com/ProjectASAP/ASAPPlanner", rev = "10d93846f0ef9f06ab19e599701d699d9cdd15af" }
asap-aware-mapping = { git = "https://github.com/ProjectASAP/ASAPPlanner", rev = "10d93846f0ef9f06ab19e599701d699d9cdd15af" }
asap-frontend-promql = { git = "https://github.com/ProjectASAP/ASAPPlanner", rev = "10d93846f0ef9f06ab19e599701d699d9cdd15af" }
asap-frontend-sql = { git = "https://github.com/ProjectASAP/ASAPPlanner", rev = "10d93846f0ef9f06ab19e599701d699d9cdd15af" }
planner-types = { package = "asap-types", git = "https://github.com/ProjectASAP/ASAPPlanner", rev = "cd7e9e0f710816d49190dabd6c789359067a208f" }
asap-aware-mapping = { git = "https://github.com/ProjectASAP/ASAPPlanner", rev = "cd7e9e0f710816d49190dabd6c789359067a208f" }
asap-frontend-promql = { git = "https://github.com/ProjectASAP/ASAPPlanner", rev = "cd7e9e0f710816d49190dabd6c789359067a208f" }
asap-frontend-sql = { git = "https://github.com/ProjectASAP/ASAPPlanner", rev = "cd7e9e0f710816d49190dabd6c789359067a208f" }

# Shared external deps (used by 2+ crates)
serde = { version = "1.0", features = ["derive"] }
Expand Down
39 changes: 20 additions & 19 deletions control_plane/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -645,19 +645,20 @@ fn compile_physical_plan_request(
)
.map_err(|error| (StatusCode::UNPROCESSABLE_ENTITY, error.to_string().into()))?;
let planner_selection_trace = compilation_request.planner_selection_trace.clone();
let (manifests, alternatives) = physical::workload_cost::compile_candidates_for_pricing(
candidates.clone(),
environment.clone(),
frontend,
);
let (manifests, candidate_evaluations) =
physical::workload_cost::compile_candidates_for_pricing(
candidates.clone(),
environment.clone(),
frontend,
);
let apply_timeout = Duration::from_millis(request.apply_timeout_ms);
// Quote preparation enumerates feasible bindings; it does not select the
// default warm candidate, which may be unavailable while exact is valid.
if manifests_only {
if manifests.is_empty() {
return Err((
StatusCode::UNPROCESSABLE_ENTITY,
serde_json::json!({"status": "all_infeasible", "alternatives": alternatives,
serde_json::json!({"status": "all_infeasible", "candidates": candidate_evaluations,
"logical_selection": compilation_request.planner_selection_trace}),
));
}
Expand All @@ -666,7 +667,7 @@ fn compile_physical_plan_request(
request.target_collector_ids,
apply_timeout,
request.runtime_adaptation_evidence,
(manifests, alternatives, planner_selection_trace),
(manifests, candidate_evaluations, planner_selection_trace),
));
}
let compiled = match request.workload_cost_evidence {
Expand All @@ -688,7 +689,7 @@ fn compile_physical_plan_request(
};
let bundle = match compiled {
Ok(bundle) => bundle,
Err(physical::compiler::CompileError::Alternatives(report)) => {
Err(physical::compiler::CompileError::Candidates(report)) => {
return Err((StatusCode::UNPROCESSABLE_ENTITY, report))
}
Err(error) => return Err((StatusCode::UNPROCESSABLE_ENTITY, error.to_string().into())),
Expand All @@ -698,7 +699,7 @@ fn compile_physical_plan_request(
request.target_collector_ids,
apply_timeout,
request.runtime_adaptation_evidence,
(manifests, alternatives, planner_selection_trace),
(manifests, candidate_evaluations, planner_selection_trace),
))
}

Expand Down Expand Up @@ -735,9 +736,9 @@ fn workload_cost_manifests(
}
let explain = request.explain;
match compile_physical_plan_request(request, true, frontend) {
Ok((_, _, _, _, (manifests, alternatives, planner_selection_trace))) => {
Ok((_, _, _, _, (manifests, candidates, planner_selection_trace))) => {
if explain {
Json(serde_json::json!({"manifests": manifests, "alternatives": alternatives, "logical_selection": planner_selection_trace}))
Json(serde_json::json!({"manifests": manifests, "candidates": candidates, "logical_selection": planner_selection_trace}))
.into_response()
} else {
Json(manifests).into_response()
Expand Down Expand Up @@ -866,12 +867,12 @@ mod api_tests {
let manifests = body_json(response).await;
if explain {
assert_eq!(manifests["manifests"].as_array().unwrap().len(), 1);
let alternatives = manifests["alternatives"].as_array().unwrap();
assert_eq!(alternatives.len(), 2);
assert_eq!(alternatives[0]["status"], "bind_failed");
assert!(alternatives[0]["unavailable_reason"].is_string());
assert_eq!(alternatives[1]["status"], "bound");
assert!(alternatives[1]["physical_alternative_id"].is_string());
let candidates = manifests["candidates"].as_array().unwrap();
assert_eq!(candidates.len(), 2);
assert_eq!(candidates[0]["status"], "bind_failed");
assert!(candidates[0]["unavailable_reason"].is_string());
assert_eq!(candidates[1]["status"], "bound");
assert!(candidates[1]["physical_candidate_id"].is_string());
assert!(!manifests["logical_selection"]
.as_array()
.unwrap()
Expand All @@ -889,8 +890,8 @@ mod api_tests {
assert_eq!(response.headers()["content-type"], "application/json");
let report = body_json(response).await;
assert_eq!(report["status"], "all_infeasible");
assert_eq!(report["alternatives"].as_array().unwrap().len(), 2);
assert!(report["alternatives"]
assert_eq!(report["candidates"].as_array().unwrap().len(), 2);
assert!(report["candidates"]
.as_array()
.unwrap()
.iter()
Expand Down
2 changes: 1 addition & 1 deletion control_plane/src/physical/backend_stage.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Backend-facing projection of one planning cycle.
//!
//! These types are the input to [`crate::backend_plan::from_stage_config`] and
//! to `emit::backend_wire`'s backend JSON builders. `PhysicalCompiler` builds
//! to `emit::backend_wire`'s backend JSON builders. `PhysicalPlanCompiler` builds
//! them directly from the summaries ASAPPlanner selected.
//!
//! They are deliberately not `Serialize`/`Deserialize`: `SummaryFamilyType`
Expand Down
Loading
Loading