Skip to content

Commit 89e6980

Browse files
committed
Add handling of no metrics response
1 parent 7b4f221 commit 89e6980

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

simvue/client.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,6 +1099,9 @@ def get_metric_values(
10991099
max_points=max_points or -1,
11001100
)
11011101

1102+
if not run_metrics:
1103+
return None
1104+
11021105
if aggregate:
11031106
return aggregated_metrics_to_dataframe(
11041107
run_metrics, xaxis=xaxis, parse_to=output_format
@@ -1156,6 +1159,12 @@ def plot_metrics(
11561159
aggregate=False,
11571160
)
11581161

1162+
if data is None:
1163+
raise RuntimeError(
1164+
f"Cannot plot metrics {metric_names}, "
1165+
f"no data found for runs {run_ids}."
1166+
)
1167+
11591168
# Undo multi-indexing
11601169
flattened_df = data.reset_index()
11611170

simvue/converters.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ def parse_run_set_metrics(
120120
ValueError
121121
if an unrecognised parse format is specified
122122
"""
123+
if not request_response_data:
124+
if parse_to == "dataframe":
125+
return pandas.DataFrame({})
126+
else:
127+
return {}
128+
123129
_all_steps: list[float] = sorted(
124130
set(
125131
(

0 commit comments

Comments
 (0)