@@ -40,15 +40,20 @@ def _check_serialized_optimized_run(self, run_id):
4040 predictions = arff .loads (openml ._api_calls ._read_url (predictions_url ))
4141
4242 # downloads the best model based on the optimization trace
43- print (run_id )
44- time .sleep (60 )
45- model_prime = openml .runs .initialize_model_from_trace (run_id , 0 , 0 )
43+ # suboptimal (slow), and not guaranteed to work if evaluation
44+ # engine is behind. TODO: mock this? We have the arff already on the server
45+ secCount = 0
46+ while secCount < 70 :
47+ try :
48+ model_prime = openml .runs .initialize_model_from_trace (run_id , 0 , 0 )
49+ break
50+ except openml .exceptions .OpenMLServerException :
51+ time .sleep (10 )
52+ secCount += 10
4653
4754 run_prime = openml .runs .run_task (task , model_prime , avoid_duplicate_runs = False )
4855 predictions_prime = run_prime ._generate_arff_dict ()
4956
50- print (model_prime )
51-
5257 self .assertEquals (len (predictions_prime ['data' ]), len (predictions ['data' ]))
5358
5459 # The original search model does not submit confidence bounds,
@@ -161,6 +166,9 @@ def test_run_optimize_bagging_diabetes(self):
161166 run = self ._perform_run (task_id , num_test_instances , grid_search )
162167 self .assertEqual (len (run .trace_content ), num_iterations * num_folds )
163168
169+ res = self ._check_serialized_optimized_run (run .run_id )
170+ self .assertTrue (res )
171+
164172 def test_run_pipeline (self ):
165173 task_id = 115
166174 num_instances = 768
0 commit comments