Skip to content

Commit 967ee55

Browse files
committed
added filter on rescheduled exps in cancel_empty_pending_jobs
1 parent ecac97d commit 967ee55

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/seml/commands/manage.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)