Allow worker-saturation=0 to disable worker queuing by hyangminj · Pull Request #9173 · dask/distributed

@claude

Fixes dask#9116

This change allows setting `worker-saturation` to 0, which disables
worker-side queuing entirely. Tasks are only sent to completely idle
workers (no tasks in processing queue, excluding seceded tasks).

This is useful for workloads with long-running tasks where you want
to avoid head-of-line blocking - shorter tasks won't get stuck behind
long-running tasks in worker queues.

Changes:
- Modified `_task_slots_available()` to handle saturation_factor=0
  by only allowing task assignment when worker is completely idle
- Updated validation to accept values >= 0 (previously required > 0)
- Updated schema to allow minimum: 0 (previously exclusiveMinimum: 0)
- Added documentation for saturation=0 special case
- Added test case for saturation=0.0
- Added test to ensure negative values are still rejected

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

@hyangminj

HyangMin Jeong and others added 2 commits

January 4, 2026 00:22
The previous implementation returned 0 for idle workers when
saturation_factor=0, which caused _worker_full() to incorrectly
mark idle workers as full (since it checks `<= 0`). This prevented
any tasks from being assigned, causing test timeouts.

Changed _task_slots_available() to return 1 for idle workers when
saturation_factor=0, allowing idle workers to accept tasks while
still preventing queuing on busy workers.

Behavior with saturation_factor=0:
- Idle worker: slots = 1 (can accept tasks)
- Worker with 1 task: slots = 0 (marked as full)
- Worker with seceded task: slots = 1 (can accept tasks)

Fixes test_saturation_factor[0.0-expected_task_counts5] timeout.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
When saturation_factor=0, workers should accept tasks up to their thread
count without queuing. The previous implementation returned only 1 slot
for idle workers, causing multi-threaded workers to underutilize threads.

Now returns ws.nthreads - active_tasks, allowing workers to fill all
idle threads while preventing queuing (head-of-line blocking).

Fixes test_saturation_factor[0.0] which expects (2, 1) task distribution
for workers with (2, 1) threads respectively.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>