Skip to content

Commit

Permalink
Minimise race-conditions 2
Browse files Browse the repository at this point in the history
  • Loading branch information
BitTheByte committed Sep 18, 2023
1 parent 244c96d commit 5b332f4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions dask_kubernetes/operator/controller/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,13 +603,17 @@ async def daskworkergroup_replica_update(
pending_workers.append(worker)

if pending_workers:
logger.info(f"Pending worker deployments to delete: {pending_workers}")
deleted_deployments = []
for worker in pending_workers:
if await worker.ready():
continue
await worker.delete()
deleted_deployments.append(worker)
logger.info(
f"Deleted pending worker deployments: {deleted_deployments}"
)

n_workers = -workers_needed - len(pending_workers)
n_workers = -workers_needed - len(deleted_deployments)
if n_workers > 0:
worker_ids = await retire_workers(
n_workers=n_workers,
Expand Down

0 comments on commit 5b332f4

Please sign in to comment.