You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "zachliu (via GitHub)" <gi...@apache.org> on 2026/03/14 01:50:41 UTC

[I] Task duration tooltip is incorrect for a running task with previous tries [airflow]

zachliu opened a new issue, #63573:
URL: https://github.com/apache/airflow/issues/63573

   ### Apache Airflow version
   
   3.1.8
   
   ### If "Other Airflow 3 version" selected, which one?
   
   _No response_
   
   ### What happened?
   
   For a running task, the duration in its tooltip is not calculated but just a copy from previous try.
   
   <img width="382" height="236" alt="Image" src="https://github.com/user-attachments/assets/331d111a-70f5-4c33-ae68-877d3ec043af" />
   
   <img width="461" height="240" alt="Image" src="https://github.com/user-attachments/assets/9e03b0bc-4817-46b2-bb83-ce3bdf693751" />
   
   <img width="462" height="241" alt="Image" src="https://github.com/user-attachments/assets/2b56d519-6fc9-4a0f-a9ca-464061b11599" />
   
   ### What you think should happen instead?
   
   The duration for a running task should be calculated and reflected in its tooltip.
   
   ### How to reproduce
   
   Re-run a finished task and see its tooltip in the grid view.
   
   ### Operating System
   
   LM 21.3 with docker python:3.12-slim-bookworm
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Docker-Compose
   
   ### 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
   
   - [x] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Task duration tooltip is incorrect for a running task with previous tries [airflow]

Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi closed issue #63573: Task duration tooltip is incorrect for a running task with previous tries
URL: https://github.com/apache/airflow/issues/63573


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Task duration tooltip is incorrect for a running task with previous tries [airflow]

Posted by "Subham-KRLX (via GitHub)" <gi...@apache.org>.
Subham-KRLX commented on issue #63573:
URL: https://github.com/apache/airflow/issues/63573#issuecomment-4062950408

   @tirkarthi Great investigation! You're right that the backend holds onto the previous try's duration.
   A clean way to fix this without changing backend logic is to dynamically calculate the duration in the UI for running tasks. I'll put up a PR that updates TaskInstanceTooltip.tsx to use the getDuration utility for live calculation when the state is running or deferred.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Task duration tooltip is incorrect for a running task with previous tries [airflow]

Posted by "tirkarthi (via GitHub)" <gi...@apache.org>.
tirkarthi commented on issue #63573:
URL: https://github.com/apache/airflow/issues/63573#issuecomment-4060624307

   This looks like an issue from the backend response where if a task is retried then the task_instance_history doesn't immediately create an entry but the task_instance table is updated with the try_number and the duration remains the same. Hence on tries endpoint it takes the existing tries and adds the current task instance which doesn't have duration reset but holds on to the last try's duration value.
   
   https://github.com/apache/airflow/blob/56090bd8e466052c30e9a565197c2d4cfb8b81c8/airflow-core/src/airflow/api_fastapi/core_api/routes/public/task_instances.py#L342-L346
   
   ```
   mysql> select try_number, start_date, task_id, state, run_id, duration from task_instance where task_id = "fail_task" order by run_id;
   +------------+----------------------------+-----------+---------+--------------------------------------+----------+
   | try_number | start_date                 | task_id   | state   | run_id                               | duration |
   +------------+----------------------------+-----------+---------+--------------------------------------+----------+
   |          2 | 2026-03-14 19:41:00.203532 | fail_task | running | scheduled__2026-03-14T01:00:00+00:00 |  43.7898 |
   +------------+----------------------------+-----------+---------+--------------------------------------+----------+
   1 row in set (0.01 sec)
   
   mysql> select try_number, start_date, task_id, state, run_id, duration from task_instance_history where task_id = "fail_task" order by run_id;
   +------------+----------------------------+-----------+--------+--------------------------------------+----------+
   | try_number | start_date                 | task_id   | state  | run_id                               | duration |
   +------------+----------------------------+-----------+--------+--------------------------------------+----------+
   |          1 | 2026-03-14 19:40:00.024494 | fail_task | failed | scheduled__2026-03-14T01:00:00+00:00 |  43.7898 |
   +------------+----------------------------+-----------+--------+--------------------------------------+----------+
   
   ```
   
   ```python
   from __future__ import annotations
   
   from datetime import timedelta
   
   from pendulum import datetime
   
   from airflow.exceptions import AirflowException
   from airflow.sdk import DAG, task
   
   with DAG(
       dag_id="gh63573",
       schedule="0 1 * * *",
       start_date=datetime(2026, 1, 1),
       catchup=False,
       default_args={"retries": 3, "retry_delay": timedelta(seconds=10)},
   ):
   
       @task
       def fail_task():
           import time
   
           time.sleep(1000)
           raise AirflowException("fail")
   
       fail_task()
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org