The GitHub Actions job "Tests" on airflow.git has failed.
Run started by GitHub user dstandish (triggered by dstandish).

Head commit for run:
3938f71dfae21c84a3518625543a28ad02edf641 / Daniel Standish 
<[email protected]>
Scheduler to handle incrementing of try_number (#39336)

Previously, there was a lot of bad stuff happening around try_number.

We incremented it when task started running. And because of that, we had this 
logic to return "_try_number + 1" when task not running. But this gave the 
"right" try number before it ran, and the wrong number after it ran. And, since 
it was naively incremented when task starts running -- i.e. without regard to 
why it is running -- we decremented it when deferring or exiting on a 
reschedule.

What I do here is try to remove all of that stuff:

no more private _try_number attr
no more getter logic
no more decrementing
no more incrementing as part of task execution
Now what we do is increment only when the task is set to scheduled and only 
when it's not coming out of deferral or "up_for_reschedule". So the try_number 
will be more stable. It will not change throughout the course of task 
execution. The only time it will be incremented is when there's legitimately a 
new try.

One consequence of this is that try number will no longer be incremented if you 
run either airlfow tasks run or ti.run() in isolation. But because airflow 
assumes that all tasks runs are scheduled by the scheduler, I do not regard 
this to be a breaking change.

If user code or provider code has implemented hacks to get the "right" 
try_number when looking at it at the wrong time (because previously it gave the 
wrong answer), unfortunately that code will just have to be patched. There are 
only two cases I know of in the providers codebase -- openlineage listener, and 
dbt openlineage.

As a courtesy for backcompat we also add property _try_number which is just a 
proxy for try_number, so you'll still be able to access this attr. But, it will 
not behave the same as it did before.

---------

Co-authored-by: Jed Cunningham <[email protected]>

Report URL: https://github.com/apache/airflow/actions/runs/9011670561

With regards,
GitHub Actions via GitBox


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to