Skip to content

Apply Gantt date filters to mapped tasks and task groups - #75725

Open
deepujain wants to merge 1 commit into
apache:mainfrom
deepujain:fix-63715-gantt-aggregate-range
Open

deepujain wants to merge 1 commit into
apache:mainfrom
deepujain:fix-63715-gantt-aggregate-range

Conversation

@deepujain

@deepujain deepujain commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

After clearing and rerunning tasks, a Gantt date filter can hide old individual attempts while mapped task and task group bars still span the old dates. A December 31 filter can leave an aggregate bar starting on December 1. Summary bars now use the same date bounds as individual attempts, so the chart stays focused on the selected window.

Matching archived attempts contribute timing, while the latest matching try supplies each task instance's state and count. This prevents an old failed try and a current success from counting as two children. Filtered and unfiltered summaries use the same live Dag structure. When no attempts match, the empty summary clears the previous bars; Grid and Gantt share that existing-run check.

These real application captures use the same persisted SQLite example run with Start Date set to December 31, 2024. The scale changes from roughly a month to a few hours. No scheduler was run. The PNGs have been removed from this branch; the links retain the earlier application capture.

Before:

Airflow Gantt before the fix

After:

Airflow Gantt after the fix

Validation:

  • The three date-window regressions fail against the base implementation and pass with the fix. Five failing review cases also pass with the repair. All 131 focused grid/Gantt API tests passed.
  • Native ARM64 Python 3.11 API/Always suites: 6,886 database tests passed with 24 skipped; 1,273 non-database tests passed with one expected failure. A provider-layout filesystem scan timed out, then passed unchanged under the same 60-second limit after an ignored local dependency cache was moved out of its traversal.
  • Selected common.compat/fab suites: 425 database tests passed with 5 skipped; 622 non-database tests passed with 12 skipped.
  • Main UI: 2,360 passed and 4 skipped, with two page-loading wait failures. Both unchanged failed files and the changed Gantt/stream tests passed in a targeted rerun, 17 tests total. The SimpleAuthManager UI test passed.
  • Full-diff regular/manual hooks, normal commit hooks, UI asset builds and OpenAPI regeneration passed. breeze build-docs apache-airflow common.compat fab passed for all three packages.

Local database checks used SQLite; hosted checks are pending. The initial broad-run timing failures and their passing targeted reruns are separate results.

closes: #63715


Was generative AI tooling used to co-author this PR?
  • Yes (OpenAI Codex)

Generated-by: OpenAI Codex following the guidelines

@boring-cyborg boring-cyborg Bot added area:API Airflow's REST/HTTP API area:UI Related to UI/UX. For Frontend Developers. labels Oct 27, 2026
@deepujain
deepujain marked this pull request as ready for review October 29, 2026 16:54

@bbovenzi bbovenzi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please provide real before/after screenshots. That is not the airflow UI

@deepujain
deepujain force-pushed the fix-63715-gantt-aggregate-range branch from cf02d2d to eca9736 Compare November 1, 2026 07:38

@bbovenzi bbovenzi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to fix the include_all_attempts and the png files.

Let's also add a test that includes a date range where a group has an old failed try and a current success at the same time to make sure we fix the bug from include_all_attempts

Comment thread files/gantt-real-ui-after.png Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete this file

Comment thread files/gantt-real-ui-before.png Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete this file

or_(
TaskInstance.state != TaskInstanceState.UP_FOR_RETRY, TaskInstance.state.is_(None)
)
).execution_options(include_all_attempts=True)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

include_all_attempts counts each archived attempt as a child, so when filtered child_states and the overall state can change.

.execution_options(yield_per=1000)
)
structure_version_id = None
if has_date_filter:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The structure shouldn’t change because a filter was added. Unfiltered, we build the tree from first.dag_version_id. Filtered, we use the newest live version. On a run whose TIs span Dag versions, adding a date pill can regroup tasks under different group bars.

Can we pick the version the same way in both paths (from live TIs only, ignoring archived attempts)?

)
if summary is None:
continue
if summary is None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the same “filtered, but the run exists → return an empty result instead of nothing” check as filtered_existing_run in gantt.py

Let's make a shared util

Old tries can stretch aggregate bars across a month after clearing a run. Date filters must also constrain those aggregates so task durations remain readable.

Related: apache#63715.
Signed-off-by: Deepak Jain <deepujain@gmail.com>
@deepujain
deepujain force-pushed the fix-63715-gantt-aggregate-range branch from eca9736 to a9d8fe2 Compare November 8, 2026 07:23
@deepujain

Copy link
Copy Markdown
Contributor Author

@bbovenzi, the PR description now has real before/after Airflow screenshots from eca9736, and a9d8fe2 removes both PNGs from the branch. In a9d8fe2, matching tries contribute timing but only the latest matching try contributes a child state, with a regression covering an old failure and current success in the same date range. That commit also makes filtered and unfiltered summaries choose the same newest live Dag version and shares the empty-filter existing-run check between Grid and Gantt.


Drafted-by: OpenAI Codex (no human review before posting)

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

area:API Airflow's REST/HTTP API area:UI Related to UI/UX. For Frontend Developers. need workflow approval

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a time range selector for the Gantt view

2 participants