Skip to content

Use the parent FIFO generation for nested task priority - #9425

Open
ApacheWang wants to merge 1 commit into
dask:mainfrom
ApacheWang:fix/nested-submission-fifo-generation
Open

ApacheWang wants to merge 1 commit into
dask:mainfrom
ApacheWang:fix/nested-submission-fifo-generation

Conversation

@ApacheWang

Copy link
Copy Markdown

Summary

Fixes Scheduler._set_priorities in distributed/scheduler.py to derive nested task FIFO generation from the parent task's generation (sts.priority[1]) instead of its negated user priority (sts.priority[0]).

Root Cause

Task priorities are assigned as (-annotated_prio, generation, internal_priority[ts.key]) (distributed/scheduler.py:5354). When a task submits nested sub-tasks, _set_priorities computed:

generation = sts.priority[0] - 0.01

Because index 0 holds -annotated_prio rather than generation:

  • With negative user priorities (e.g. user_priority=-10), a parent at generation 2 gave its nested sub-task generation 9.99, sorting the sub-task behind its parent and behind newer unrelated tasks (generation=3).
  • With default priority 0, a parent at generation 2 gave its nested sub-task generation -0.01, jumping ahead of older unrelated tasks (generation=1) instead of staying just before its parent (1.99).

Fix

Read the parent's FIFO generation from sts.priority[1]:

generation = sts.priority[1] - 0.01

Verification

  • RED (on origin/main with test_nested_submission_fifo_priority): failed because nested task received priority (10, 9.99, 0), sorting after parent (10, 2, 0) and newer (10, 3, 0).

  • GREEN (with fix): distributed/tests/test_scheduler.py::test_nested_submission_fifo_priority passes; broader offline scheduler tests pass (261 passed).

  • ruff check and ruff format --check pass on both modified files.

  • Tests added / passed

  • Passes lint (ruff check & ruff format --check)

Signed-off-by: bc15575202581 <bc15575202581@gmail.com>
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Unit Test Results

See test report for an extended history of previous test failures. This is useful for diagnosing flaky tests.

    48 files  ± 0      48 suites  ±0   15h 59m 17s ⏱️ - 17m 32s
 4 192 tests + 1   4 010 ✅  -  1    178 💤 ±0  4 ❌ +2 
98 119 runs  +22  93 008 ✅ +22  5 107 💤  - 2  4 ❌ +2 

For more details on these failures, see this check.

Results for commit c02a6f7. ± Comparison against base commit ddc7515.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant