Repository navigation
feat(asap-tools): run the e2e planner through the rqe-optimizer MILP (planner.use_optimizer) #831
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,15 +9,23 @@ services: | |
| - TZ=UTC | ||
| volumes: | ||
| - {{ input_config_path }}:/app/input/config.yaml:ro | ||
| - {{ output_dir }}:/app/output | ||
| - {{ output_dir }}:/app/output{% if saturation_dir %} | ||
| - {{ saturation_dir }}:/app/saturation:ro | ||
| - {{ workload_facts }}:/app/input/workload_facts.yaml:ro{% endif %} | ||
| command: [ | ||
| "--input_config", "/app/input/config.yaml", | ||
| "--output_dir", "/app/output", | ||
| "--data-ingestion-interval-ms", "{{ data_ingestion_interval_ms }}", | ||
| "--streaming_engine", "{{ streaming_engine }}", | ||
| "--query-language", "{{ query_language }}"{% if prometheus_url %}, | ||
| "--prometheus-url", "{{ prometheus_url }}"{% endif %}{% if punting %}, | ||
| "--enable-punting"{% endif %} | ||
| "--enable-punting"{% endif %}{% if saturation_dir %}, | ||
| "--planner", "milp", | ||
| "--workload-facts", "/app/input/workload_facts.yaml", | ||
| "--atomic-costs", "/app/saturation/optimizer_cost/rqe_atomic_costs.json", | ||
| "--saturation-dir", "/app/saturation"{% endif %}{% if w_cpu is not none %}, | ||
| "--w-cpu", "{{ w_cpu }}"{% endif %}{% if w_mem is not none %}, | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: |
||
| "--w-mem", "{{ w_mem }}"{% endif %} | ||
| ] | ||
| network_mode: "host" | ||
| restart: no | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -339,6 +339,7 @@ def main(cfg: DictConfig) -> None: | |
| + config.required_cloudlab_params(cfg), | ||
| script_name="experiment_run_clickhouse", | ||
| ) | ||
| config.require_legacy_planner(cfg, "experiment_run_clickhouse") | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| config.validate_experiment_config(cfg.experiment_params) | ||
|
|
||
| provider = create_provider(cfg) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,6 +45,7 @@ def main(cfg: DictConfig): | |
| config.validate_config(cfg) | ||
| # Validate experiment configuration | ||
| config.validate_experiment_config(cfg.experiment_params) | ||
| milp = config.milp_planner(cfg) | ||
|
|
||
| # Convert config to args-like object for backward compatibility | ||
| # (also constructs the infrastructure provider, exposed as args.provider) | ||
|
|
@@ -173,8 +174,9 @@ def main(cfg: DictConfig): | |
| config.generate_controller_client_configs( | ||
| cfg.experiment_params, | ||
| local_experiment_root_dir, | ||
| cfg.aggregate_cleanup, | ||
| cfg.get("sketch_parameters", None), | ||
| # The MILP rejects both; it chooses sketch parameters and cleanup itself. | ||
| None if milp else cfg.aggregate_cleanup, | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: with the optimizer on, |
||
| None if milp else cfg.get("sketch_parameters", None), | ||
| cfg.get("windowing", None), | ||
| ) | ||
| ) | ||
|
|
@@ -323,6 +325,7 @@ def main(cfg: DictConfig): | |
| punting=args.controller_punting, | ||
| discovery_backend=discovery_backend, | ||
| data_ingestion_interval_ms=data_ingestion_interval_ms, | ||
| milp=milp, | ||
| ) | ||
| sync.rsync_controller_config_remote_to_local( | ||
| provider, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,12 +7,13 @@ | |
| import os | ||
| import copy | ||
| import yaml | ||
| from typing import Any, Dict, List, Tuple | ||
| from typing import Any, Dict, List, Optional, Tuple | ||
|
|
||
| from omegaconf import DictConfig, ListConfig, OmegaConf | ||
|
|
||
| import constants | ||
| from experiment_utils.providers.factory import create_provider | ||
| from experiment_utils.services.misc import MilpPlanner | ||
|
|
||
| # Keys the planner's `ControllerOptions` accepts. | ||
| CONTROLLER_OPTION_KEYS = {"accuracy_sla", "latency_sla_ms"} | ||
|
|
@@ -738,6 +739,49 @@ def validate_config(cfg: DictConfig, script_name: str = "experiment_run_e2e"): | |
| ) | ||
|
|
||
|
|
||
| def milp_planner(cfg: DictConfig) -> Optional[MilpPlanner]: | ||
| """`planner.*` as the planner's MILP inputs, or None for the legacy planner. | ||
|
|
||
| Fails on settings --planner milp can't honor rather than dropping them. | ||
| """ | ||
| planner = cfg.get("planner") | ||
| if planner is None or not planner.get("use_optimizer", False): | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
| return None | ||
| conflicts = [ | ||
| f"planner.{key} is unset" | ||
| for key in ("saturation_dir", "workload_facts") | ||
| if not planner.get(key) | ||
| ] | ||
| if cfg.controller.punting: | ||
| conflicts.append("controller.punting=true") | ||
| if cfg.controller.get("auto_discover_labels", False): | ||
| conflicts.append("controller.auto_discover_labels=true") | ||
| if cfg.get("windowing") is not None: | ||
| conflicts.append("windowing is set") | ||
| if conflicts: | ||
| raise ValueError( | ||
| "planner.use_optimizer=true (asap-planner --planner milp) conflicts with: " | ||
| + "; ".join(conflicts) | ||
| + ". Pass planner.use_optimizer=false for the legacy planner." | ||
| ) | ||
| return MilpPlanner( | ||
| saturation_dir=planner.saturation_dir, | ||
| workload_facts=planner.workload_facts, | ||
| w_cpu=planner.get("w_cpu"), | ||
| w_mem=planner.get("w_mem"), | ||
| ) | ||
|
|
||
|
|
||
| def require_legacy_planner(cfg: DictConfig, script_name: str) -> None: | ||
| """For scripts whose planner runs can't use --planner milp.""" | ||
| planner = cfg.get("planner") | ||
| if planner is not None and planner.get("use_optimizer", False): | ||
| raise ValueError( | ||
| f"{script_name} supports only the legacy planner; " | ||
| "pass planner.use_optimizer=false." | ||
| ) | ||
|
|
||
|
|
||
| def _load_sql_queries(sql_file: str) -> List[str]: | ||
| """Read a SQL file and return individual statements, preserving comment lines.""" | ||
| with open(sql_file) as f: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cost-table path is written in two places: here and as
COST_TABLEinexperiment_utils/services/misc.py. Pass it into the template (e.g./app/saturation/{{ cost_table }}) so there is one source of truth.