File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -87,12 +87,25 @@ def cancel_empty_pending_jobs(db_collection_name: str, *sacred_ids: int):
8787 # There are still pending experiments, we don't want to cancel the jobs.
8888 return
8989 pending_exps = list (collection .find ({'_id' : {'$in' : sacred_ids }}, {'slurm' }))
90+ rescheduled_exps = list (
91+ collection .find (
92+ {'_id' : {'$in' : sacred_ids }, 'status' : {'$in' : States .RESCHEDULED }},
93+ {'execution' },
94+ )
95+ )
96+ rescheduled_ids = []
97+ for exp in rescheduled_exps :
98+ execution = exp ['execution' ]
99+ if 'array_id' in execution :
100+ rescheduled_ids .append (execution ['array_id' ])
101+
90102 array_ids = {
91103 conf ['array_id' ]
92104 for exp in pending_exps
93105 for conf in exp ['slurm' ]
94106 if 'array_id' in conf
95107 }
108+ array_ids = array_ids .difference (rescheduled_ids )
96109 # Only cancel the pending jobs
97110 cancel_slurm_jobs (* array_ids , state = SETTINGS .SLURM_STATES .PENDING [0 ])
98111
You can’t perform that action at this time.
0 commit comments