Skip to content

Add a time range selector for the Gantt view #63715

Closed

Description

@atuls4441

Apache Airflow version

main (development)

If "Other Airflow 3 version" selected, which one?

No response

What happened?

Image

What you think should happen instead?

Gantt view for each task should show correct bars representing start and end time.
Image

No response

How to reproduce

  1. Run any Dag on airflow main branch
  2. Clear dagrun and notice the gantt view.

Operating System

Linux

Versions of Apache Airflow Providers

No response

Deployment

Other

Deployment details

No response

Anything else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

  1. added
    kind:bug
    needs-triage
    on Mar 16, 2026
  2. added
    affected_version:3.2
    and removed
    needs-triage
    on Mar 16, 2026
  3. added
    area:UI
    on Mar 16, 2026
  4. added
    priority:high
    on Mar 16, 2026
  5. pierrejeambrun commented on Mar 16, 2026

    @pierrejeambrun
    Member

    More information on this.

    Since we enabled the Gantt to show All task tries: #61058 this has some side effects.

    I agree that this can feel confusing and that this prevent having a precise representation of task duration for a specific 'run/clear/tries set'. This is the expected behavior though and a side effect of showing all tries, converting this into a feature request

    What happens:

    If I have a run with TI running in ~ a few minutes. And after a week, I want to clear the run. Then the Gantt chart time window will be a week, to be able to display tries 1 and tries 2 of each TI. Since tasks execution time is really small compare to the Gantt time window (1 week) virtually this will force all TIs and TIHs to have the smallest width possible, making this impossible to dissociate long running from short running tasks. This problem will happen for every dag and every run if we wait long enough between the initial run and the clear action.

    We do not know which TIH belongs to which clear, so it's no possible to introduce a selector there.

    I thought about maybe we could simply add a flag such as 'Show TaskInstance History' checkbox so we could decide whether or not we want to see historical TI in the Gantt (possibly crushing the durations) or if we should only show the latest tries which will belong to the same Run (most likely). That's basically a checkbox for enablinghttps://github.com/apache/airflow/pull/61058, by default True. The problem is that we could still have the same behavior if we clear a single TI manually.

    Suggestion

    So maybe we should simply add a start date/end date range filter in the Gantt endpoint/UI so we can 'zoom in/out' on specific parts of the Gantt chart to be able to have a more precise representation if needed.

  6. added
    type:new-feature
    and removed
    kind:bug
    priority:high
    affected_version:3.2
    on Mar 16, 2026
  7. added this to the Airflow 3.2.0 milestone on Mar 16, 2026
  8. 20 remaining items

  9. venkatamandavilli-code commented on Jun 16, 2026

    @venkatamandavilli-code

    Thanks for raising this enhancement.

    A time range selector in the Gantt view would be useful from an operational troubleshooting perspective. In production environments, users often review DAG runs after retries, clears, reruns, or delayed task executions, and being able to narrow the displayed time window would make it easier to understand task duration, overlaps, and execution sequencing.

    This could also help platform and support teams analyze long-running workflows without visually scanning the entire timeline. A focused time range filter would improve usability, especially for DAGs with many tasks or complex dependency chains.

    I would be interested in helping with this if maintainers think it is suitable for a first UI contribution.

  10. pierrejeambrun commented on Jun 19, 2026

    @pierrejeambrun
    Member

    @venkatamandavilli-code Please go ahead, feel free to open a PR. Be sure to check our guidelines for contribution. (tools, AI assited PR, etc...)

  11. venkatamandavilli-code commented on Jun 19, 2026

    @venkatamandavilli-code

    @pierrejeambrun,

    Thank you for the encouragement and guidance.

    I'll review the contribution guidelines and take a closer look at the implementation details to determine whether I can put together a suitable PR for this enhancement.

  12. ashutosh264 commented on Aug 7, 2026

    @ashutosh264
    Contributor

    Working on this: adding a datetime range FilterBar control for Gantt that passes start_date_gte / end_date_lte to GET /ui/gantt/{dag_id}/{run_id} with server-side overlap filtering (including NULL start/end for queued/running tasks) and clamping the Gantt axis to the selected window. Opening a PR this week. Taking the review feedback from #64387 into account (reuse DateRangeFilter, full datetime precision, no filters inside the chart layout box).

  13. wiasliaw commented on Sep 22, 2026

    @wiasliaw
    Contributor

    I'd like to confirm the intended filter semantics. There are two possible shapes:

    1. A single time window [from, to]: the "zoom" reading of this issue. The chart shows every task instance that overlaps the window: start_date <= to AND (end_date >= from OR end_date IS NULL). Note the mapping is crossed: the window's from bounds the task's end_date, and the window's to bounds the task's start_date. This matches the two-parameter shape Add date range filter to Gantt view #64387 used (start_date / end_date as onewindow).

    2. Two per-field range filters: a Start Date [gte, lte] range and an End Date [gte, lte] range, following the existing Grid filter convention (each pill filters one field). More expressive (e.g. "tasks that ended during an incident window"), but to zoom the user has to work out the crossed mapping themselves, which seems wrong for the use case described here. (My PR is implemented based on option 2.)

    Two questions:

    • should the UI expose a single time-window filter (option 1), or per-field ranges (option 2)?
    • When a window is active, should the Gantt x-axis clamp exactly to [from, to], or to the min/max of the filtered bars (a partially overlapping bar would then stretch the axis beyond the window)?

    Drafted-by: Claude Code (Fable 5)

  14. jhaabhijeet864 commented on Oct 1, 2026

    @jhaabhijeet864

    Hi @bbovenzi @pierrejeambrun @potiuk (and team),

    I’ve opened this PR to finally close out #63715. Before writing a single line of code, I spent time auditing the previous attempts at this (#61058) and specifically took your feedback into account to ensure this doesn't become another closed PR.

    I wanted to hand you a complete, production-ready package that eases your review burden. Here is how this implementation guarantees we don't hit the performance pitfalls of the previous attempts:

    1. Zero Client-Side Bloat: We are no longer trying to fetch every task instance and filter it in React. This is a pure server-side implementation, meaning Gantt charts for massive DAGs will stay snappy and won't OOM the browser.
    2. Strict Index Preservation: I noticed a previous attempt used COALESCE(end_date, NOW()) which destroys index utilization and forces full table scans. I explicitly avoided this. The SQL logic here uses or_(TaskInstance.end_date >= start_date_gte, TaskInstance.end_date.is_(None)). This ensures running/queued tasks still render perfectly while keeping the database execution plan optimized.
    3. Clean OpenAPI Pipeline: I've wired this seamlessly through GridFilters.tsx and updated the gantt.py endpoint. I intentionally avoided committing fragile manual patches to openapi-gen/; the CI's openapi-merge-cli pipeline will automatically pick up the new types.

    This should be a clean, low-risk drop-in that significantly improves the UX for large DAG executions. Looking forward to your thoughts!

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:UIgood first issuetype:new-feature

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions