Skip to content
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

Fix TriggeredDagRunOperator triggered link #40336

Merged

Conversation

fredthomsen
Copy link
Contributor

@fredthomsen fredthomsen commented Jun 20, 2024

Link to the specific dag run id that was triggered, as opposed to the logical date, such that the instance that was triggered on the DAG grid UI.

This was alluded to in #19264, but you want the DAG run that was triggered select in the DAG grid UI.

Current link and DAG grid UI view:
Screenshot 2024-06-19 at 19 18 08

This PR's changed link and DAG grid UI view:
Screenshot 2024-06-19 at 19 38 17

Simple DAGs to demonstrate:

from airflow.decorators import dag, task
from airflow.operators.trigger_dagrun import TriggerDagRunOperator


@dag()
def triggering_dag():
    t = TriggerDagRunOperator(
        trigger_dag_id="triggered_dag",
        task_id="triggering_task",
    )

    t

@dag()
def triggered_dag():
    @task()
    def empty_task() -> int:
        return 0

    empty_task()

triggering_dag()
triggered_dag()

^ 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 newsfragments.

@boring-cyborg boring-cyborg bot added the area:core-operators Operators, Sensors and hooks within Core Airflow label Jun 20, 2024
@fredthomsen fredthomsen force-pushed the fixLinkToTriggeredDagRunFromTriggeringDag branch 2 times, most recently from e41d994 to ec04aaf Compare June 20, 2024 02:21
@eladkal eladkal added this to the Airflow 2.9.3 milestone Jun 20, 2024
@eladkal eladkal added the type:bug-fix Changelog: Bug Fixes label Jun 20, 2024
Link to the specific dag run id that was triggered, as opposed to the
logical date, such that the instance that was triggered on the DAG grid
UI.
@fredthomsen fredthomsen force-pushed the fixLinkToTriggeredDagRunFromTriggeringDag branch from 21bff51 to 9f949b0 Compare June 21, 2024 03:11
@eladkal eladkal merged commit 806bb80 into apache:main Jun 22, 2024
49 checks passed
@sbrinkhorst
Copy link

Hi all,

I think the URL should include both the execution_date and the dag_run_id. Because if you only include the dag_run_id it will not work if that value is not in the 25 latest dag runs (or whatever you've set as default_dag_run_display_number).

@eladkal
Copy link
Contributor

eladkal commented Jun 26, 2024

Hi all,

I think the URL should include both the execution_date and the dag_run_id. Because if you only include the dag_run_id it will not work if that value is not in the 25 latest dag runs (or whatever you've set as default_dag_run_display_number).

Why not?

@eladkal
Copy link
Contributor

eladkal commented Jun 26, 2024

If you refer to #39642 it has already been fixed

@sbrinkhorst
Copy link

Has the way url's are processed changed since the release of 2.9.2? Because now I see changes in how the url's are generated, but not in how they are processed. Because I'm unable to build the latest version locally, so I'm testing on 2.9.2, but I can manually create url's based on what I see in the code/screenshots.

If I look at the url visible in the screenshot and substitute the values for my own setup, I get an URL that doesn't work for DagRuns not in the latest 25. So I have https://<url>/dags/<dagName>/grid?dag_run_id=<runId> for an older run it doesn't work. It takes the execution date of the dag run I refer to, but only shows runs older than that date. So the right most run is the one before the run I'm actually looking for.

If I make it https://<url>/dags/<dagName>/grid?dag_run_id=<runId>&execution_date=<date> the correct run is actually visible and selected.

(I'm quite sceptical about #396442 actually being fixed by that MR.)

@eladkal
Copy link
Contributor

eladkal commented Jun 26, 2024

The PR I shared is targeted to 2.9.3 which hasnt been released yet.

If you want to report a problem please first check with main branch. If you find a bug you can open Github issue with the reporduce example

utkarsharma2 pushed a commit that referenced this pull request Jul 2, 2024
* Fix TriggeredDagRunOperator triggered link

Link to the specific dag run id that was triggered, as opposed to the
logical date, such that the instance that was triggered on the DAG grid
UI.

* Add comment regarding triggered dag xcom

(cherry picked from commit 806bb80)
utkarsharma2 pushed a commit that referenced this pull request Jul 2, 2024
* Fix TriggeredDagRunOperator triggered link

Link to the specific dag run id that was triggered, as opposed to the
logical date, such that the instance that was triggered on the DAG grid
UI.

* Add comment regarding triggered dag xcom

(cherry picked from commit 806bb80)
ephraimbuddy pushed a commit that referenced this pull request Jul 2, 2024
* Fix TriggeredDagRunOperator triggered link

Link to the specific dag run id that was triggered, as opposed to the
logical date, such that the instance that was triggered on the DAG grid
UI.

* Add comment regarding triggered dag xcom

(cherry picked from commit 806bb80)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:core-operators Operators, Sensors and hooks within Core Airflow type:bug-fix Changelog: Bug Fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants