Share worker setup, residual preparation, and scenario capture
This commit is contained in:
parent
591560949c
commit
0c059cc7d6
2 changed files with 88 additions and 151 deletions
|
|
@ -7,8 +7,8 @@ from dataclasses import asdict
|
|||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
|
||||
from inire.tests.example_scenarios import PERFORMANCE_SCENARIO_SNAPSHOTS, SCENARIO_SNAPSHOTS
|
||||
from inire.results import RouteMetrics
|
||||
from inire.tests.example_scenarios import capture_scenario_snapshots
|
||||
|
||||
|
||||
SUMMARY_KEYS = (
|
||||
|
|
@ -26,12 +26,6 @@ SUMMARY_KEYS = (
|
|||
)
|
||||
|
||||
|
||||
def _snapshot_registry(include_performance_only: bool) -> tuple[tuple[str, object], ...]:
|
||||
if not include_performance_only:
|
||||
return SCENARIO_SNAPSHOTS
|
||||
return SCENARIO_SNAPSHOTS + PERFORMANCE_SCENARIO_SNAPSHOTS
|
||||
|
||||
|
||||
def _available_metric_names() -> tuple[str, ...]:
|
||||
return (
|
||||
"duration_s",
|
||||
|
|
@ -47,13 +41,8 @@ def _current_snapshots(
|
|||
*,
|
||||
include_performance_only: bool,
|
||||
) -> dict[str, dict[str, object]]:
|
||||
allowed = None if selected_scenarios is None else set(selected_scenarios)
|
||||
snapshots: dict[str, dict[str, object]] = {}
|
||||
for name, run in _snapshot_registry(include_performance_only):
|
||||
if allowed is not None and name not in allowed:
|
||||
continue
|
||||
snapshots[name] = asdict(run())
|
||||
return snapshots
|
||||
snapshots = capture_scenario_snapshots(selected_scenarios, include_performance_only=include_performance_only)
|
||||
return {snapshot.name: asdict(snapshot) for snapshot in snapshots}
|
||||
|
||||
|
||||
def _load_baseline(path: Path, selected_scenarios: tuple[str, ...] | None) -> dict[str, dict[str, object]]:
|
||||
|
|
|
|||
|
|
@ -7,27 +7,7 @@ from dataclasses import asdict
|
|||
from datetime import date
|
||||
from pathlib import Path
|
||||
|
||||
from inire.tests.example_scenarios import PERFORMANCE_SCENARIO_SNAPSHOTS, SCENARIO_SNAPSHOTS
|
||||
|
||||
|
||||
SUMMARY_METRICS = (
|
||||
"route_iterations",
|
||||
"nets_routed",
|
||||
"nodes_expanded",
|
||||
"ray_cast_calls",
|
||||
"moves_generated",
|
||||
"moves_added",
|
||||
"dynamic_tree_rebuilds",
|
||||
"visibility_builds",
|
||||
"congestion_check_calls",
|
||||
"verify_path_report_calls",
|
||||
)
|
||||
|
||||
|
||||
def _snapshot_registry(include_performance_only: bool) -> tuple[tuple[str, object], ...]:
|
||||
if not include_performance_only:
|
||||
return SCENARIO_SNAPSHOTS
|
||||
return SCENARIO_SNAPSHOTS + PERFORMANCE_SCENARIO_SNAPSHOTS
|
||||
from inire.tests.example_scenarios import capture_scenario_snapshots
|
||||
|
||||
|
||||
def _build_payload(
|
||||
|
|
@ -35,12 +15,7 @@ def _build_payload(
|
|||
*,
|
||||
include_performance_only: bool = False,
|
||||
) -> dict[str, object]:
|
||||
allowed = None if selected_scenarios is None else set(selected_scenarios)
|
||||
snapshots = []
|
||||
for name, run in _snapshot_registry(include_performance_only):
|
||||
if allowed is not None and name not in allowed:
|
||||
continue
|
||||
snapshots.append(run())
|
||||
snapshots = capture_scenario_snapshots(selected_scenarios, include_performance_only=include_performance_only)
|
||||
return {
|
||||
"generated_on": date.today().isoformat(),
|
||||
"generator": "scripts/record_performance_baseline.py",
|
||||
|
|
|
|||
Loading…
Reference in a new issue