-
Notifications
You must be signed in to change notification settings - Fork 14.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TriggerDagRunOperator External Link doesn't link with execution date to match to triggered DAG #19264
Comments
Thanks for opening your first issue here! Be sure to follow the issue template! |
Oh, one more thing to note: a band-aid solution I'm currently using is to set the |
Hey @ljades, I looked into this, but couldn't replicate it on current main branch. Do you have example dag(s) code to repro the issue? |
Sure! Here's an excerpt that's based on the stuff I have in my own application (left out company-specific stuff, and stitched together methods from different modules).
|
I see an even more odd behaviour. In the URL I see a time stamp that is definitely before the triggered dag (it is from the triggering dag), but the UI still renders all recent dags (as if the filter was not applied!). When I click on the "Update" filter button to apply the filter from the URL, I indeed no longer seen the latest triggered dag run. So I'm observing two issues:
UPDATE: |
In fact, if I modify the All this testing is on main, btw. |
From reading the views.py code, it's looking for an url argument called |
Okay, now that I can reproduce it I think I can fix this issue, or at least give it a shot :) @potiuk can you assign this one to me? Note: This issue aside, I still stand by the statement of the webserver filtering user experience being quite bad. The url paramters don't properly update the UI for example (the date has no effect and the num runs is updated but not to the value you provided). This needs some investment I think. |
I dug through history and it seems like Lines 100 to 104 in ff1ab97
But the graph endpoint later went through some refactoring and now takes a |
Yupp that's what I saw as well. I'll patch it up so the right arg is passed in. As for the wrong date being used: after a bit more investigation, it's going to be quite tricky to get the execution date of the triggered dag at the point the extra link code is being evaluated. Because both the triggered dag's execution time and dag run id are both calculated at runtime in the |
I think you can store the triggered DAG's execution date on the operator instance, and do |
Worst case scenario and it's a bit much to query for the trigger datetime for the triggered DAG itself, I mentioned earlier it could help settling for removing the param/filter entirely from the link. It wouldn't zero in on the particular DAG triggered, but it'd still be effective. |
Yeah, this was my first thought at well. But But do correct me if I'm wrong here, perhaps there was an error in my testing. |
I think you're right. Honestly I don't feel the extra SQL query is that problematic, it's not like the link is rendered in a lot of places, and we can at least cache the result so there's only one additional query for each render. |
Okay, I'll play around with this. I'm still not sure there is the required data for a query either, but I'll try some things out. |
So after poking at this a bit more, I don't think it's possible with the current schema: When we create the triggered dag run, the only noteworthy thing we set is Paths forward:
|
By the way, since
If this makes sense, I can create a new issue about it. |
Yes, but that’s an entirely different issue and should be worked on separately. Feel free to open a pull request for that, but let’s leave that discussion out of this particular issue. |
I agree with @uranusjr that is a separate issue. Let's resolve this issue and cut a new one? |
Closed in #19410 |
New issue reference: #26916 |
Apache Airflow version
2.2.0 (latest released)
Operating System
Debian
Versions of Apache Airflow Providers
No response
Deployment
Docker-Compose
Deployment details
Using base Docker image astronomerinc/ap-airflow:2.0.2-2-buster.
What happened
The TriggerDagRunOperator embeds an external link that links to the DAG that's being triggered. The problem is, the link currently includes a parameter for restricting to execution dates EARLIER than the execution date of the triggering DAG itself.
This means that the external link is always guaranteed to not link to the right DAG run (and not even show it as an option until you manually change the execution date filter in the new page). It links to the DAG page but never to the right instance without some manual tampering after clicking on the link.
What you expected to happen
The Triggered DAG should point to the execution date of the triggered dag, not the triggerING DAG.
If this is not feasible, it should at least point to the Triggered DAG page with no execution date constraints. At least this would show the latest run, and it will include in the dropdown the triggered run.
How to reproduce
Create a DAG with a TriggerDagRunOperator that triggers another DAG. Run the former DAG, wait for the task to run. Click on the task, click on the "Triggered DAG" external link. It will not show the triggered run that just happened. You will need to manually adjust the date constraint in the upper left of the DAG views, and then select your run.
Anything else
No response
Are you willing to submit PR?
Code of Conduct
The text was updated successfully, but these errors were encountered: