Skip to content

Commit c4ae8cd

Browse files
committed
Improve the error message on out-of-sync flow ids (openml#1171)
* Improve the error message on out-of-sync flow ids * Add more meaningful messages on test fail
1 parent 259cdd3 commit c4ae8cd

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

openml/setups/functions.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ def setup_exists(flow) -> int:
4242
# checks whether the flow exists on the server and flow ids align
4343
exists = flow_exists(flow.name, flow.external_version)
4444
if exists != flow.flow_id:
45-
raise ValueError("This should not happen!")
45+
raise ValueError(
46+
f"Local flow id ({flow.id}) differs from server id ({exists}). "
47+
"If this issue persists, please contact the developers."
48+
)
4649

4750
openml_param_settings = flow.extension.obtain_parameter_values(flow)
4851
description = xmltodict.unparse(_to_dict(flow.flow_id, openml_param_settings), pretty=True)

tests/test_runs/test_run_functions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,13 +1117,13 @@ def test__run_exists(self):
11171117

11181118
flow = self.extension.model_to_flow(clf)
11191119
flow_exists = openml.flows.flow_exists(flow.name, flow.external_version)
1120-
self.assertGreater(flow_exists, 0)
1120+
self.assertGreater(flow_exists, 0, "Server says flow from run does not exist.")
11211121
# Do NOT use get_flow reinitialization, this potentially sets
11221122
# hyperparameter values wrong. Rather use the local model.
11231123
downloaded_flow = openml.flows.get_flow(flow_exists)
11241124
downloaded_flow.model = clf
11251125
setup_exists = openml.setups.setup_exists(downloaded_flow)
1126-
self.assertGreater(setup_exists, 0)
1126+
self.assertGreater(setup_exists, 0, "Server says setup of run does not exist.")
11271127
run_ids = run_exists(task.task_id, setup_exists)
11281128
self.assertTrue(run_ids, msg=(run_ids, clf))
11291129

0 commit comments

Comments
 (0)