Skip to content

Fix: DecreasingPriorityStrategy example by initializing try_number before weight evaluation#62148

Open
aeroyorch wants to merge 1 commit intoapache:mainfrom
aeroyorch:fix-priority-weight-strategy-init-try-number
Open

Fix: DecreasingPriorityStrategy example by initializing try_number before weight evaluation#62148
aeroyorch wants to merge 1 commit intoapache:mainfrom
aeroyorch:fix-priority-weight-strategy-init-try-number

Conversation

@aeroyorch
Copy link
Contributor

Description

The documented DecreasingPriorityStrategy can fail because get_weight() may run while TaskInstance is still partially initialized, so ti.try_number is not ready. This PR applies a small fix by initializing try_number before refresh_from_task() and adds a regression test case for DecreasingPriorityStrategy.

Notes

This is a minimal fix. As a follow-up, it would be worth exploring whether priority strategies could be evaluated with richer context (including DagRun/logical_date) and outside early lifecycle initialization. For example, this could enable strategies that decrease priority for older logical dates.


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

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

Comments