Skip to content

Commit

Permalink
fix cancel creating jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
jigold committed Nov 29, 2023
1 parent 339931d commit 18f0c7a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions batch/batch/driver/canceller.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,19 +194,20 @@ async def user_cancelled_creating_jobs(user, remaining) -> AsyncIterator[Dict[st
''',
(user,),
):
async for record in self.db.select_and_fetchall(
'''
if job_group['cancelled']:
async for record in self.db.select_and_fetchall(
'''
SELECT jobs.job_id, attempts.attempt_id, attempts.instance_name
FROM jobs FORCE INDEX(jobs_batch_id_state_always_run_cancelled)
STRAIGHT_JOIN attempts
ON attempts.batch_id = jobs.batch_id AND attempts.job_id = jobs.job_id
WHERE jobs.batch_id = %s AND jobs.job_group_id = %s AND state = 'Creating' AND always_run = 0 AND cancelled = 0
LIMIT %s;
''',
(job_group['batch_id'], job_group['job_group_id'], remaining.value),
):
record['batch_id'] = job_group['batch_id']
yield record
(job_group['batch_id'], job_group['job_group_id'], remaining.value),
):
record['batch_id'] = job_group['batch_id']
yield record

waitable_pool = WaitableSharedPool(self.async_worker_pool)

Expand Down

0 comments on commit 18f0c7a

Please sign in to comment.