You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/10/03 11:56:53 UTC

[GitHub] [airflow] mik-laj commented on a change in pull request #11254: Add operator link to access DAG triggered by TriggerDagRunOperator

mik-laj commented on a change in pull request #11254:
URL: https://github.com/apache/airflow/pull/11254#discussion_r499141752



##########
File path: airflow/operators/dagrun_operator.py
##########
@@ -20,12 +20,19 @@
 from typing import Dict, Optional, Union
 
 from airflow.api.common.experimental.trigger_dag import trigger_dag
-from airflow.models import BaseOperator, DagRun
+from airflow.models import BaseOperator, DagRun, BaseOperatorLink
 from airflow.utils import timezone
 from airflow.utils.decorators import apply_defaults
 from airflow.utils.types import DagRunType
 
 
+class TriggerDagRunLink(BaseOperatorLink):
+    name = 'Triggered DAG'
+
+    def get_link(self, operator: "TriggerDagRunOperator", dttm):
+        return f"/graph?dag_id={operator.trigger_dag_id}&root=&execution_date={dttm}"

Review comment:
       Can you escape dttm? This may contain characters not allowed in the URL.




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

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