Skip to content

Fix deferral paths in task lifecycle diagram - #75428

Merged
kaxil merged 2 commits into
apache:mainfrom
shivaam:docs-task-lifecycle-deferral-paths
Oct 23, 2026
Merged

kaxil merged 2 commits into
apache:mainfrom
shivaam:docs-task-lifecycle-deferral-paths

Conversation

@shivaam

@shivaam shivaam commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

The task lifecycle diagram on the Tasks docs page has a few mistakes on the deferral and resume paths:

  • Tasks with start_from_trigger=True are drawn going through scheduled, the executor and queued before they reach the triggerer. The scheduler defers these tasks itself: DagRun.schedule_tis calls TaskInstance.defer_task, which creates the trigger and moves the task instance straight to deferred, so it never reaches scheduled or queued. The check now comes just before scheduled, and queued leads straight to the worker.
  • When a trigger fires and the task still has to finish on a worker, the diagram sent it back through all of the scheduler's checks, so a start_from_trigger task was drawn looping back to the triggerer. handle_event_submit sets the task instance to scheduled directly, so that arrow now points at scheduled.
  • A Human-in-the-loop task leaving awaiting_input resumes the same way, from both the response route and the scheduler's timeout sweep, so its arrow now points at scheduled too.
  • Both triggerer diamonds were labelled "A triggerer task?" although they ask different things. They now read "Starts in the triggerer? (start_from_trigger)" and "Trigger ends the task? (end_from_trigger)".

Only the diagram changes. The image and its checksum were regenerated with the generate-airflow-diagrams hook.

Before and after

The changed arrows and labels are drawn in red for review only. The committed diagram keeps its usual colours. Click an image to open it at full size.

Before (main):

Task lifecycle diagram on main, changed arrows and labels in red

After (this PR):

Task lifecycle diagram in this PR, changed arrows and labels in red

The swapped YES/NO labels on "Required upstream task(s) failed?" are fixed separately in #74520. The two changes touch different lines of the script, so whichever merges second only needs the image regenerated.


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Opus 5.5)

Generated-by: Claude Code (Opus 5.5) following the guidelines

The diagram routed tasks with start_from_trigger=True through scheduled,
the executor and queued before handing them to the triggerer. The
scheduler defers these tasks itself: DagRun.schedule_tis calls
TaskInstance.defer_task, which creates the trigger and sets the task
instance to deferred, so it never reaches scheduled or queued.

It also sent a task whose trigger had fired back through the
scheduler's checks, so a start_from_trigger task that finishes on a
worker was drawn looping back to the triggerer. When a trigger fires,
handle_event_submit sets the task instance to scheduled directly.
@shivaam
shivaam marked this pull request as ready for review October 22, 2026 20:51
@kaxil kaxil added the backport-to-v3-4-test Backport to v3-4-test label Oct 22, 2026
@kaxil kaxil added this to the Airflow 3.4.0 milestone Oct 22, 2026
Both diamonds were labelled "A triggerer task?" but ask different
things: the first is start_from_trigger, the second is whether the
trigger ends the task (end_from_trigger). With the same label, a
start_from_trigger sensor reads as never going back to a worker for
next_method.

A Human-in-the-loop task leaving awaiting_input also resumes through
handle_event_submit, from both the response route and the scheduler's
timeout sweep, so it lands in scheduled directly instead of going back
through the scheduler's checks.
shivaam added a commit to shivaam/airflow that referenced this pull request Oct 23, 2026
@kaxil
kaxil merged commit e144499 into apache:main Oct 23, 2026
60 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Backport successfully created: v3-4-test

Note: As of Merging PRs targeted for Airflow 3.X
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.

In matter of doubt please ask in #release-management Slack channel.

Status Branch Result
✅ v3-4-test PR Link

kaxil pushed a commit that referenced this pull request Oct 23, 2026
…5515)

(cherry picked from commit e144499)

Co-authored-by: Shivam Rastogi <6463385+shivaam@users.noreply.github.com>
@shahar1 shahar1 linked an issue Nov 6, 2026 that may be closed by this pull request
2 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-to-v3-4-test Backport to v3-4-test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update Task Life Cycle Diagram to include flow for Deferred Operators

2 participants