@@ -50,7 +50,7 @@ def test_smac_hyperband_termination():
5050 # Goal: first launch 13 jobs in bracket 1, then 6 in bracket 2, then 3 in bracket 3, then 2 and terminate
5151 keyword = "Launching "
5252 all_keyword_indices = [m .start () for m in re .finditer (keyword , process_logs )]
53- n_jobs_spawned = [int (process_logs [occ + len (keyword ): occ + len (keyword )+ 2 ]) for occ in all_keyword_indices ]
53+ n_jobs_spawned = [int (process_logs [occ + len (keyword ) : occ + len (keyword ) + 2 ]) for occ in all_keyword_indices ]
5454 total_jobs_spawned = sum (n_jobs_spawned )
5555
5656 assert total_jobs_spawned == 20 , (
@@ -68,6 +68,7 @@ def test_smac_hyperband_termination():
6868
6969 shutil .rmtree (Path ("mlp_smac_hyperband" ))
7070
71+
7172def test_smac_hyperband_optimizer_termination ():
7273 if Path ("mlp_smac_hyperband" ).exists ():
7374 shutil .rmtree (Path ("mlp_smac_hyperband" ))
@@ -88,13 +89,11 @@ def test_smac_hyperband_optimizer_termination():
8889 # Goal: first launch 13 jobs in bracket 1, then 6 in bracket 2, then 3 in bracket 3, then 2 and terminate
8990 keyword = "Launching "
9091 all_keyword_indices = [m .start () for m in re .finditer (keyword , process_logs )]
91- n_jobs_spawned = [int (process_logs [occ + len (keyword ): occ + len (keyword )+ 2 ]) for occ in all_keyword_indices ]
92+ n_jobs_spawned = [int (process_logs [occ + len (keyword ) : occ + len (keyword ) + 2 ]) for occ in all_keyword_indices ]
9293 total_jobs_spawned = sum (n_jobs_spawned )
9394 print (n_jobs_spawned )
9495
95- assert total_jobs_spawned == 23 , (
96- f"Optimizer termination not happening. Used: { total_jobs_spawned } , expected: 23."
97- )
96+ assert total_jobs_spawned == 23 , f"Optimizer termination not happening. Used: { total_jobs_spawned } , expected: 23."
9897 assert n_jobs_spawned [0 ] == 13 , (
9998 f"Number of spawned jobs in bracket 1 is incorrect. Used: { n_jobs_spawned [0 ]} , expected: 13."
10099 )
0 commit comments