Skip to content

Commit

Permalink
Fix process_submitted_jobs instance lock (#2279)
Browse files Browse the repository at this point in the history
Fixes: #2274
  • Loading branch information
un-def authored Feb 10, 2025
1 parent fec1085 commit 39f6321
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,14 @@ async def _process_submitted_job(session: AsyncSession, job_model: JobModel):
detaching_instances_ids = await get_instances_ids_with_detaching_volumes(session)
# Refetch after lock
res = await session.execute(
select(InstanceModel).where(
select(InstanceModel)
.where(
InstanceModel.id.not_in(detaching_instances_ids),
InstanceModel.id.in_(instances_ids),
InstanceModel.deleted == False,
InstanceModel.total_blocks > InstanceModel.busy_blocks,
)
.execution_options(populate_existing=True)
)
pool_instances = list(res.unique().scalars().all())
instance = await _assign_job_to_pool_instance(
Expand Down

0 comments on commit 39f6321

Please sign in to comment.