Skip to content

Add handling of no metrics response #411

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 1 commit into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions simvue/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1099,6 +1099,9 @@ def get_metric_values(
max_points=max_points or -1,
)

if not run_metrics:
return None

if aggregate:
return aggregated_metrics_to_dataframe(
run_metrics, xaxis=xaxis, parse_to=output_format
Expand Down Expand Up @@ -1156,6 +1159,12 @@ def plot_metrics(
aggregate=False,
)

if data is None:
raise RuntimeError(
f"Cannot plot metrics {metric_names}, "
f"no data found for runs {run_ids}."
)

# Undo multi-indexing
flattened_df = data.reset_index()

Expand Down
6 changes: 6 additions & 0 deletions simvue/converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ def parse_run_set_metrics(
ValueError
if an unrecognised parse format is specified
"""
if not request_response_data:
if parse_to == "dataframe":
return pandas.DataFrame({})
else:
return {}

_all_steps: list[float] = sorted(
set(
(
Expand Down
Loading