-
Notifications
You must be signed in to change notification settings - Fork 1
Pr3 analysis #33
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
Merged
Merged
Pr3 analysis #33
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
032ed49
Add power consumption and mean price metrics for debugging and analysis.
5c39257
Evaluation: add cost-normalized job metrics and persist them in episo…
5538e50
Analysis: add third occupancy row for cost-per-1k and power deltas
9cf06b3
Analysis: add arrival-scale sweep script and evaluation arrival-rate …
6cfefa0
Analysis: add baseline/arrival/drop metrics and per-panel plot exports
d3d273d
Analysis QoL: Output directories now include weight combination and m…
5af5255
Fix analyzer parsing for per-episode savings output
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| from __future__ import annotations | ||
|
|
||
|
|
||
| def _format_slug_number(value: float) -> str: | ||
| return f"{float(value):.6f}".rstrip("0").rstrip(".").replace("-", "m").replace(".", "p") | ||
|
|
||
|
|
||
| def build_weight_slug( | ||
| efficiency_weight: float, | ||
| price_weight: float, | ||
| idle_weight: float, | ||
| job_age_weight: float, | ||
| ) -> str: | ||
| return ( | ||
| f"e{_format_slug_number(efficiency_weight)}" | ||
| f"_p{_format_slug_number(price_weight)}" | ||
| f"_i{_format_slug_number(idle_weight)}" | ||
| f"_ja{_format_slug_number(job_age_weight)}" | ||
| ) | ||
|
|
||
|
|
||
| def build_analysis_dir_name( | ||
| prefix: str, | ||
| timestamp: str, | ||
| model: int | None, | ||
| efficiency_weight: float, | ||
| price_weight: float, | ||
| idle_weight: float, | ||
| job_age_weight: float, | ||
| ) -> str: | ||
| parts = [prefix] | ||
| if model is not None: | ||
| parts.append(f"m{int(model)}") | ||
| parts.append( | ||
| build_weight_slug( | ||
| efficiency_weight=efficiency_weight, | ||
| price_weight=price_weight, | ||
| idle_weight=idle_weight, | ||
| job_age_weight=job_age_weight, | ||
| ) | ||
| ) | ||
| parts.append(timestamp) | ||
| return "_".join(parts) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| from __future__ import annotations | ||
|
|
||
| import math | ||
|
|
||
|
|
||
| def validate_job_arrival_scale(job_arrival_scale: float) -> float: | ||
| """Return a normalized arrival scale or raise for invalid values.""" | ||
| scale = float(job_arrival_scale) | ||
| if not math.isfinite(scale) or scale < 0.0: | ||
| raise ValueError("--job-arrival-scale must be finite and >= 0.0") | ||
| return scale | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| from __future__ import annotations | ||
|
|
||
| import math | ||
| from typing import Mapping, Sequence | ||
|
|
||
|
|
||
| def _fmt_optional(value: float | int | None, precision: int = 2, thousands: bool = False) -> str: | ||
| if value is None: | ||
| return "n/a" | ||
|
|
||
| numeric_value = float(value) | ||
| if math.isnan(numeric_value): | ||
| return "n/a" | ||
|
|
||
| return f"{numeric_value:,.{precision}f}" if thousands else f"{numeric_value:.{precision}f}" | ||
|
|
||
|
|
||
| def mean_occupancy_pct(values: Sequence[int], capacity: int) -> float: | ||
| if not values or capacity <= 0: | ||
| return 0.0 | ||
| return float(sum(values) * 100.0 / (len(values) * capacity)) | ||
|
|
||
|
|
||
| def build_episode_summary_line( | ||
| episode_number: int, | ||
| episode_data: Mapping[str, float | int], | ||
| timeline_max_queue: int, | ||
| agent_occupancy_cores_pct: float, | ||
| baseline_occupancy_cores_pct: float, | ||
| agent_occupancy_nodes_pct: float, | ||
| baseline_occupancy_nodes_pct: float, | ||
| ) -> str: | ||
| return ( | ||
| f" Episode {episode_number}: " | ||
| f"Agent Cost=€{float(episode_data['agent_cost']):.0f}, " | ||
| f"Baseline Cost=€{float(episode_data['baseline_cost']):.0f} | " | ||
| f"Baseline Off=€{float(episode_data['baseline_cost_off']):.0f}, " | ||
| f"Savings=€{float(episode_data['savings_vs_baseline']):.0f}/" | ||
| f"€{float(episode_data['savings_vs_baseline_off']):.0f}, " | ||
| f"Power={float(episode_data['agent_power_consumption_mwh']):.1f}/" | ||
| f"{float(episode_data['baseline_power_consumption_mwh']):.1f}/" | ||
| f"{float(episode_data['baseline_power_consumption_off_mwh']):.1f} MWh " | ||
| f"(agent/base/base_off), " | ||
| f"MeanPrice={float(episode_data['agent_mean_price']):.2f}/" | ||
| f"{float(episode_data['baseline_mean_price']):.2f}/" | ||
| f"{float(episode_data['baseline_off_mean_price']):.2f} €/MWh " | ||
| f"(agent/base/base_off), " | ||
| f"CostPer1kCompleted=" | ||
| f"{_fmt_optional(episode_data['agent_cost_per_1000_completed_jobs'], 1, thousands=True)}/" | ||
| f"{_fmt_optional(episode_data['baseline_cost_per_1000_completed_jobs'], 1, thousands=True)}/" | ||
| f"{_fmt_optional(episode_data['baseline_off_cost_per_1000_completed_jobs'], 1, thousands=True)} " | ||
| f"€/1k (agent/base/base_off), " | ||
| f"DroppedPerSavedEuro=" | ||
| f"{_fmt_optional(episode_data['agent_dropped_jobs_per_saved_euro'], 6)}/" | ||
| f"{_fmt_optional(episode_data['agent_dropped_jobs_per_saved_euro_off'], 6)} " | ||
| f"jobs/€ (vs base/base_off), " | ||
| f"Jobs={int(episode_data['jobs_completed'])}/{int(episode_data['jobs_submitted'])} " | ||
| f"({float(episode_data['completion_rate']):.0f}%), " | ||
| f"AvgWait={float(episode_data['avg_wait_time']):.1f}h, " | ||
| f"EpisodeMaxQueue={int(episode_data['max_queue_size'])}, " | ||
| f"Dropped={int(episode_data['jobs_dropped'])}, " | ||
| f"TimelineMaxQueue={timeline_max_queue}, " | ||
| f"Agent Occupancy (Cores)={agent_occupancy_cores_pct:.2f}%, " | ||
| f"Baseline Occupancy (Cores)={baseline_occupancy_cores_pct:.2f}%, " | ||
| f"Agent Occupancy (Nodes)={agent_occupancy_nodes_pct:.2f}%, " | ||
| f"Baseline Occupancy (Nodes)={baseline_occupancy_nodes_pct:.2f}% " | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.