Skip to content

Conversation

@yimingpeng
Copy link
Contributor

@yimingpeng yimingpeng commented Sep 1, 2025

Hello there,

This PR is an attempt to fix #55020 where the gantt chart wasn't showing real-time progress for running tasks.

closes: #55020

After applying the fix:

Screen.Recording.2025-09-01.at.9.18.13.PM.mov

^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.

@boring-cyborg
Copy link

boring-cyborg bot commented Sep 1, 2025

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our prek-hooks will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

@boring-cyborg boring-cyborg bot added the area:UI Related to UI/UX. For Frontend Developers. label Sep 1, 2025
Copy link
Member

@guan404ming guan404ming left a comment

Choose a reason for hiding this comment

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

Thanks for fix, left some comments~

@yimingpeng
Copy link
Contributor Author

Hello @guan404ming,

Thanks for all the great suggestions, I believe I have addressed them, also made a few more changes, e..g, expanding to other pending tasks (isStatePending) which was checking running only. Please help review again, thanks.

Here is the expanded test dag from the original issue post:

from datetime import datetime, timedelta

from airflow import DAG
from airflow.providers.standard.operators.bash import BashOperator
from airflow.providers.standard.operators.python import PythonOperator
from airflow.providers.standard.sensors.filesystem import FileSensor
from airflow.utils.task_group import TaskGroup

def task_that_fails():
    raise Exception("This task always fails for testing")

def task_that_succeeds():
    print("This task succeeds")
    return "success"

dag = DAG(
    'test_gantt_chart_dag',
    start_date=datetime(2025, 7, 1),
    schedule=None,
    is_paused_upon_creation=False,
    catchup=False,
    max_active_runs=1,
    default_args={
        'retries': 2,
        'retry_delay': timedelta(seconds=10),
    }
)

long_running_task = BashOperator(
    task_id="long_running_task",
    bash_command="echo 'Starting long task'; sleep 180; echo 'Long task completed'",
    dag=dag
)

queued_task = BashOperator(
    task_id="queued_task", 
    bash_command="echo 'Queued task executed'; sleep 30",
    dag=dag,
    pool='default_pool',
    pool_slots=10
)

failing_task = PythonOperator(
    task_id="failing_task",
    python_callable=task_that_fails,
    dag=dag
)

waiting_sensor = FileSensor(
    task_id="waiting_sensor",
    filepath="/tmp/nonexistent_file_for_testing.txt",
    timeout=300,
    poke_interval=30,
    dag=dag
)

scheduled_task = BashOperator(
    task_id="scheduled_task",
    bash_command="echo 'Scheduled task executed'; sleep 15",
    dag=dag
)

quick_success_task = PythonOperator(
    task_id="quick_success_task",
    python_callable=task_that_succeeds,
    dag=dag
)

upstream_failed_task = BashOperator(
    task_id="upstream_failed_task",
    bash_command="echo 'This should not run due to upstream failure'",
    dag=dag
)

with TaskGroup("processing_group", dag=dag) as processing_group:
    
    group_start = BashOperator(
        task_id="group_start",
        bash_command="echo 'Group starting'; sleep 5",
        dag=dag,
    )
    
    parallel_task_1 = BashOperator(
        task_id="parallel_task_1", 
        bash_command="echo 'Parallel task 1 running'; sleep 60",
        dag=dag,
    )
    
    parallel_task_2 = PythonOperator(
        task_id="parallel_task_2",
        python_callable=task_that_fails,
        dag=dag,
    )
    
    parallel_task_3 = BashOperator(
        task_id="parallel_task_3",
        bash_command="echo 'Parallel task 3 running'; sleep 45",
        dag=dag,
    )
    
    group_end = BashOperator(
        task_id="group_end",
        bash_command="echo 'Group completed'; sleep 10",
        trigger_rule="none_failed_min_one_success",
        dag=dag,
    )
    
    group_start >> [parallel_task_1, parallel_task_2, parallel_task_3] >> group_end

final_task = BashOperator(
    task_id="final_task",
    bash_command="echo 'All processing completed'",
    dag=dag
)

long_running_task >> scheduled_task
quick_success_task >> queued_task
failing_task >> upstream_failed_task
waiting_sensor >> scheduled_task
processing_group >> final_task

Here is the new recording after the fix is applied:

Screen.Recording.2025-09-02.at.11.13.34.PM.mov

Copy link
Member

@guan404ming guan404ming left a comment

Choose a reason for hiding this comment

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

Overall looks good, one nit

Copy link
Member

@guan404ming guan404ming left a comment

Choose a reason for hiding this comment

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

Overall looks good!

cc @bbovenzi @pierrejeambrun
would appreciate it if you could take another look when you have a moment, thanks!

@guan404ming
Copy link
Member

@yimingpeng please help rebase and fix the tests, thanks!

@yimingpeng yimingpeng force-pushed the #55020-gantt-view-is-not-getting-updatedin-realtime branch from bd88e6b to b10c1f5 Compare September 12, 2025 07:50
@yimingpeng yimingpeng force-pushed the #55020-gantt-view-is-not-getting-updatedin-realtime branch from d177a0a to 8cfbdae Compare September 14, 2025 04:46
@yimingpeng yimingpeng force-pushed the #55020-gantt-view-is-not-getting-updatedin-realtime branch from 8cfbdae to b863840 Compare September 14, 2025 08:53
@yimingpeng
Copy link
Contributor Author

hello @bbovenzi, thanks for the code review, I guess you meant DEFAULT_DATETIME_FORMAT_WITH_TZ ? Can you have another review pls? if I misunderstood anything here, please correct me, thanks

@bbovenzi bbovenzi added this to the Airflow 3.1.0 milestone Sep 15, 2025
@bbovenzi bbovenzi merged commit 67b0c79 into apache:main Sep 15, 2025
56 checks passed
kaxil pushed a commit that referenced this pull request Sep 15, 2025
* Fix real-time updates for running tasks in Gantt chart view

* Fix linting

* Use DEFAULT_DATETIME_FORMAT_WITH_TZ as recommended

* Fix linting issue

(cherry picked from commit 67b0c79)
kaxil pushed a commit that referenced this pull request Sep 15, 2025
* Fix real-time updates for running tasks in Gantt chart view

* Fix linting

* Use DEFAULT_DATETIME_FORMAT_WITH_TZ as recommended

* Fix linting issue

(cherry picked from commit 67b0c79)
yash1thsa pushed a commit to yash1thsa/airflow that referenced this pull request Sep 16, 2025
* Fix real-time updates for running tasks in Gantt chart view

* Fix linting

* Use DEFAULT_DATETIME_FORMAT_WITH_TZ as recommended

* Fix linting issue
suman-himanshu pushed a commit to suman-himanshu/airflow that referenced this pull request Sep 17, 2025
* Fix real-time updates for running tasks in Gantt chart view

* Fix linting

* Use DEFAULT_DATETIME_FORMAT_WITH_TZ as recommended

* Fix linting issue
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Sep 30, 2025
* Fix real-time updates for running tasks in Gantt chart view

* Fix linting

* Use DEFAULT_DATETIME_FORMAT_WITH_TZ as recommended

* Fix linting issue
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 1, 2025
* Fix real-time updates for running tasks in Gantt chart view

* Fix linting

* Use DEFAULT_DATETIME_FORMAT_WITH_TZ as recommended

* Fix linting issue
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 2, 2025
* Fix real-time updates for running tasks in Gantt chart view

* Fix linting

* Use DEFAULT_DATETIME_FORMAT_WITH_TZ as recommended

* Fix linting issue
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 3, 2025
* Fix real-time updates for running tasks in Gantt chart view

* Fix linting

* Use DEFAULT_DATETIME_FORMAT_WITH_TZ as recommended

* Fix linting issue
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 4, 2025
* Fix real-time updates for running tasks in Gantt chart view

* Fix linting

* Use DEFAULT_DATETIME_FORMAT_WITH_TZ as recommended

* Fix linting issue
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 5, 2025
* Fix real-time updates for running tasks in Gantt chart view

* Fix linting

* Use DEFAULT_DATETIME_FORMAT_WITH_TZ as recommended

* Fix linting issue
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 5, 2025
* Fix real-time updates for running tasks in Gantt chart view

* Fix linting

* Use DEFAULT_DATETIME_FORMAT_WITH_TZ as recommended

* Fix linting issue
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 7, 2025
* Fix real-time updates for running tasks in Gantt chart view

* Fix linting

* Use DEFAULT_DATETIME_FORMAT_WITH_TZ as recommended

* Fix linting issue
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 8, 2025
* Fix real-time updates for running tasks in Gantt chart view

* Fix linting

* Use DEFAULT_DATETIME_FORMAT_WITH_TZ as recommended

* Fix linting issue
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 9, 2025
* Fix real-time updates for running tasks in Gantt chart view

* Fix linting

* Use DEFAULT_DATETIME_FORMAT_WITH_TZ as recommended

* Fix linting issue
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 10, 2025
* Fix real-time updates for running tasks in Gantt chart view

* Fix linting

* Use DEFAULT_DATETIME_FORMAT_WITH_TZ as recommended

* Fix linting issue
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 11, 2025
* Fix real-time updates for running tasks in Gantt chart view

* Fix linting

* Use DEFAULT_DATETIME_FORMAT_WITH_TZ as recommended

* Fix linting issue
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 12, 2025
* Fix real-time updates for running tasks in Gantt chart view

* Fix linting

* Use DEFAULT_DATETIME_FORMAT_WITH_TZ as recommended

* Fix linting issue
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 14, 2025
* Fix real-time updates for running tasks in Gantt chart view

* Fix linting

* Use DEFAULT_DATETIME_FORMAT_WITH_TZ as recommended

* Fix linting issue
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 15, 2025
* Fix real-time updates for running tasks in Gantt chart view

* Fix linting

* Use DEFAULT_DATETIME_FORMAT_WITH_TZ as recommended

* Fix linting issue
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 17, 2025
* Fix real-time updates for running tasks in Gantt chart view

* Fix linting

* Use DEFAULT_DATETIME_FORMAT_WITH_TZ as recommended

* Fix linting issue
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 19, 2025
* Fix real-time updates for running tasks in Gantt chart view

* Fix linting

* Use DEFAULT_DATETIME_FORMAT_WITH_TZ as recommended

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

Labels

area:UI Related to UI/UX. For Frontend Developers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gantt view is not getting updated in realtime

3 participants