airflow
airflow copied to clipboard
Incorrect DAG Run ID opened when clicking on run_id link from DAG run list
Apache Airflow version
2.9.3
If "Other Airflow 2 version" selected, which one?
No response
What happened?
When I try to open an older DAG run by clicking on the run_id link from the DAG run list, it incorrectly opens the DAG run with a different run_id. This issue makes it difficult to view the details of specific older DAG runs.
What you think should happen instead?
Clicking on a run_id link from the dag run list should open the DAG run corresponding to that run_id.
How to reproduce
- Navigate to the DAG runs list.
- Select a specific DAG to view its run history.
- Click on the run_id link of an older DAG run in the list.
- Notice that the page loads a DAG run with an incorrect run_id.
Operating System
Linux ad25902d8cef 6.7.12-orbstack-00201-g2ddb8f197a46 #1 SMP Tue May 21 04:38:26 UTC 2024 aarch64 GNU/Linux
Versions of Apache Airflow Providers
No response
Deployment
Astronomer
Deployment details
Start an Airflow instance using the AstroCLI command astro dev start, run an example dag multiple times, and try accessing dag_run older than 25 from the dag runs list page of the Airflow UI.
Anything else?
Click on the older run_id link from the dag run list
It will open the graph view. Click on any task in the graph view, and it will show the details for the incorrect dag run_id.
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
Looks like a duplicate of https://github.com/apache/airflow/issues/40214
Looks like a duplicate of #40214
That Issue appears to be solved in 2.9.3. @hkc-8010 can you please confirm that this is occurring on 2.9.3?
It appears that the issue has been resolved for the dag_id link, which points to the Grid view. However, the run_id link, pointing to the Graph view, is still incorrect. I was able to replicate this issue on version 2.9.3.
@hkc-8010 Does run_id in the details tab match the expected value and the query string in the url? Some changes were done in https://github.com/apache/airflow/issues/35946
@tirkarthi - Here is hyperlink attached to the run_id in the Dag run list - manual__2024-08-09T08:42:25.524227+00:00
The hyperlink appears correct, but when it opens the Graph view and I click on a task, it displays an incorrect run_id—specifically, the run_id from the previous run instead of the desired one.
It seems the hyperlink is updating the calendar tab to the exact run_id value, which causes the Graph or Grid view to display only historical DAG runs, excluding the desired DAG run.
I believe this PR might resolve the issue. I'll test it on version 2.10.0 and will update you here. Thanks!
I just verified on 2.10. Still facing the same issue.
Hem and I tested this out in Airflow 2.10 (Astro runtime 12.0.0) and noticed that this bug still exists but only for certain types of runs (when the run_id timestamp is not at the 0th second of the minute).
-
When testing this out with runs scheduled to run every minute, I did not see this bug. I was able to go to Browse -> DAG Runs, find a DAG run older than the 25th record, click on the run ID, and open the correct DAG run page.
-
However, when testing this out with manual runs, the bug became apparent. For example, I triggered a manual run with
run_id=manual__2024-08-28T13:54:14.979062+00:00.- After over 25 runs, I tried opening this DAG run by clicking on the run_id in Browse-> DAG Runs. This opened the DAG without a specific run highlighted (see below).
- When I clicked on a task in the graph view, it highlighted the run that had occurred just before the run I had clicked on in the grid. The
run_idfor this wasscheduled__2024-08-28T13:54:00+00:00as indicated in the screenshot below. The run I wanted to open was not part of the grid. Hem observed this as well in his tests.
- In contrast, when I opened the DAG run for
run_id=scheduled__2024-08-28T13:54:00+00:00, it opened and highlighted the correct DAG run. This might suggest that the bug only appears for manual runs, but this is not true as described in the next bullet point.
-
When I modified the DAG to have
schedule=@continuous, the bug appeared once again for scheduled runs indicating that it is not exclusive to manual runs. For example, when I clicked on a run_id which wasscheduled__2024-08-28T16:47:22.632138+00:00, I saw the same bug as before where it opened a page without any DAG run highlighted. When i clicked on one of the tasks in the graph, it highlighted the run previous to what I clicked on in the grid. Therun_idfor this wasscheduled__2024-08-28T16:47:20.415112+00:00, and the run I was looking for was not visible in the grid. Hem observed this as well in his tests. -
Based on these observations, I believe the bug appears only for DAGs with run ID timestamps that are not at the 0th second of the minute. Due to the bug, you are only able to see the run previous to the run you wanted to locate. It does not depend on whether the run was scheduled or manually triggered. For example, the bug appeared for
run_id=scheduled__2024-08-28T16:47:22.632138+00:00but not forrun_id=scheduled__2024-08-28T13:54:00+00:00.
Fix here: https://github.com/apache/airflow/pull/42138
Let me know if this is the expected behavior. Marked for backporting so hopefully we can get that in the next patch release.