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:26:53 UTC

[GitHub] [airflow] turbaszek opened a new pull request #11254: Add operator link to access DAG triggered by TriggerDagRunOperator

turbaszek opened a new pull request #11254:
URL: https://github.com/apache/airflow/pull/11254


   This commit adds TriggerDagRunLink which allows users to access
   easily access in Web UI a DAG triggered by TriggerDagRunOperator
   
   <img width="585" alt="Screenshot 2020-10-03 at 13 21 13" src="https://user-images.githubusercontent.com/9528307/94990398-04d3b900-057c-11eb-97b5-d14384904da3.png">
   
   
   ---
   **^ Add meaningful description above**
   
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
   In case of fundamental code change, Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in [UPDATING.md](https://github.com/apache/airflow/blob/master/UPDATING.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.

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



[GitHub] [airflow] turbaszek merged pull request #11254: Add operator link to access DAG triggered by TriggerDagRunOperator

Posted by GitBox <gi...@apache.org>.
turbaszek merged pull request #11254:
URL: https://github.com/apache/airflow/pull/11254


   


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



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

Posted by GitBox <gi...@apache.org>.
kaxil commented on a change in pull request #11254:
URL: https://github.com/apache/airflow/pull/11254#discussion_r499141909



##########
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:
       Good call,
   
   We can do (or something like that):
   
   ```
   quote(self.execution_date.isoformat())
   ```




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



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

Posted by GitBox <gi...@apache.org>.
kaxil commented on a change in pull request #11254:
URL: https://github.com/apache/airflow/pull/11254#discussion_r499141909



##########
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:
       Good call,
   
   We can do (or something like that):
   
   ```
   from urllib.parse import quote
   quote(self.execution_date.isoformat())
   ```




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



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

Posted by GitBox <gi...@apache.org>.
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. We are already struggling with similar problems in Web UI.




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



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

Posted by GitBox <gi...@apache.org>.
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