Skip to content

Commit 9ce2a6b

Browse files
authored
Improve the error message on out-of-sync flow ids (#1171)
* Improve the error message on out-of-sync flow ids * Add more meaningful messages on test fail
1 parent ccb3e8e commit 9ce2a6b

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

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
@@ -1112,13 +1112,13 @@ def test__run_exists(self):
11121112

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

0 commit comments

Comments
 (0)