Skip to content

Commit 0fc7ab0

Browse files
committed
Split plot to plot_cluster and plot_envd targets
1 parent 06feb54 commit 0fc7ab0

File tree

1 file changed

+54
-20
lines changed

1 file changed

+54
-20
lines changed

test/cluster-spec-sheet/mzcompose.py

Lines changed: 54 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2326,8 +2326,8 @@ def process(scenario: str) -> None:
23262326

23272327
if args.analyze:
23282328
# Analyze both files separately (each has its own schema)
2329-
analyze_results_file(cluster_path)
2330-
analyze_results_file(envd_path)
2329+
analyze_cluster_results_file(cluster_path)
2330+
analyze_envd_results_file(envd_path)
23312331

23322332

23332333
class BenchTarget:
@@ -2666,40 +2666,73 @@ def run_scenario_weak(
26662666
scenario.run(runner)
26672667

26682668

2669-
def workflow_plot(composition: Composition, parser: WorkflowArgumentParser) -> None:
2670-
"""Analyze the results of the workflow."""
2669+
def workflow_plot_cluster(
2670+
composition: Composition, parser: WorkflowArgumentParser
2671+
) -> None:
2672+
"""Analyze cluster-focused results."""
26712673

26722674
parser.add_argument(
26732675
"files",
26742676
nargs="*",
2675-
default="results_*.csv",
2677+
default="results_*.cluster.csv",
26762678
type=str,
2677-
help="Glob pattern of result files to plot.",
2679+
help="Glob pattern of cluster result files to plot.",
26782680
)
26792681

26802682
args = parser.parse_args()
26812683

26822684
for file in itertools.chain(*map(glob.iglob, args.files)):
2683-
analyze_results_file(str(file))
2685+
analyze_cluster_results_file(str(file))
26842686

26852687

2686-
def analyze_results_file(file: str):
2687-
print(f"--- Analyzing file {file} ...")
2688+
def workflow_plot_envd(
2689+
composition: Composition, parser: WorkflowArgumentParser
2690+
) -> None:
2691+
"""Analyze environmentd-focused results."""
2692+
2693+
parser.add_argument(
2694+
"files",
2695+
nargs="*",
2696+
default="results_*.envd.csv",
2697+
type=str,
2698+
help="Glob pattern of envd result files to plot.",
2699+
)
2700+
2701+
args = parser.parse_args()
2702+
2703+
for file in itertools.chain(*map(glob.iglob, args.files)):
2704+
analyze_envd_results_file(str(file))
26882705

2689-
base_name = os.path.basename(file)
2690-
if base_name.endswith(".cluster.csv"):
2691-
analyze_cluster_results_file(file)
2692-
elif base_name.endswith(".envd.csv"):
2693-
analyze_envd_results_file(file)
2694-
else:
2695-
# Backward compatibility: fall back to cluster analyzer for legacy filenames
2696-
print(
2697-
f"Warning: Legacy analyzer fallback: treating {file} as cluster results (no .cluster/.envd suffix)"
2698-
)
2699-
analyze_cluster_results_file(file)
2706+
2707+
def workflow_plot(composition: Composition, parser: WorkflowArgumentParser) -> None:
2708+
"""Analyze the results of the workflow."""
2709+
2710+
parser.add_argument(
2711+
"files",
2712+
nargs="*",
2713+
default=["results_*.cluster.csv", "results_*.envd.csv"],
2714+
type=str,
2715+
help="Glob pattern of result files to plot.",
2716+
)
2717+
2718+
args = parser.parse_args()
2719+
2720+
for file in itertools.chain(*map(glob.iglob, args.files)):
2721+
file_str = str(file)
2722+
base_name = os.path.basename(file_str)
2723+
if base_name.endswith(".cluster.csv"):
2724+
analyze_cluster_results_file(file_str)
2725+
elif base_name.endswith(".envd.csv"):
2726+
analyze_envd_results_file(file_str)
2727+
else:
2728+
raise UIError(
2729+
f"Error: Filename '{file_str}' doesn't indicate whether it's a cluster or an envd results file (no .cluster/.envd suffix). Please use the explicit `plot-envd` or `plot-cluster` targets for such files."
2730+
)
27002731

27012732

27022733
def analyze_cluster_results_file(file: str) -> None:
2734+
print(f"--- Analyzing cluster results file {file} ...")
2735+
27032736
def extract_cluster_size(s: str) -> float:
27042737
match = re.search(r"(\d+)(?:(cc)|(C))", s)
27052738
if match:
@@ -2783,6 +2816,7 @@ def extract_cluster_size(s: str) -> float:
27832816

27842817

27852818
def analyze_envd_results_file(file: str) -> None:
2819+
print(f"--- Analyzing envd results file {file} ...")
27862820
df = pd.read_csv(file)
27872821
if df.empty:
27882822
print(f"^^^ +++ File {file} is empty, skipping")

0 commit comments

Comments
 (0)