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 2022/01/28 18:36:34 UTC

[GitHub] [airflow] josh-fell opened a new pull request #21192: Update `ExternalTaskSensorLink` to handle templated `external_dag_id`

josh-fell opened a new pull request #21192:
URL: https://github.com/apache/airflow/pull/21192


   Closes: #21183
   
   ---
   **^ Add meaningful description above**
   
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/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/main/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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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



[GitHub] [airflow] potiuk merged pull request #21192: Update `ExternalTaskSensorLink` to handle templated `external_dag_id`

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


   


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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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



[GitHub] [airflow] potiuk closed pull request #21192: Update `ExternalTaskSensorLink` to handle templated `external_dag_id`

Posted by GitBox <gi...@apache.org>.
potiuk closed pull request #21192:
URL: https://github.com/apache/airflow/pull/21192


   


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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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



[GitHub] [airflow] josh-fell commented on a change in pull request #21192: Update `ExternalTaskSensorLink` to handle templated `external_dag_id`

Posted by GitBox <gi...@apache.org>.
josh-fell commented on a change in pull request #21192:
URL: https://github.com/apache/airflow/pull/21192#discussion_r795829531



##########
File path: airflow/sensors/external_task.py
##########
@@ -40,6 +40,8 @@ class ExternalTaskSensorLink(BaseOperatorLink):
     name = 'External DAG'
 
     def get_link(self, operator, dttm):
+        ti = TaskInstance(task=operator, execution_date=dttm)
+        operator.render_template_fields({"ti": ti})

Review comment:
       Ah OK. Took a look at the other operator links too and all but one creates an ad hoc TaskInstance, but honestly those probably could just use `XCom.get_one()`.
   
   I'll update to use `ti.get_template_context()` in the meantime and test.




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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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



[GitHub] [airflow] github-actions[bot] commented on pull request #21192: Update `ExternalTaskSensorLink` to handle templated `external_dag_id`

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #21192:
URL: https://github.com/apache/airflow/pull/21192#issuecomment-1026439859


   The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest main at your convenience, or amend the last commit of the PR, and push it with --force-with-lease.


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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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



[GitHub] [airflow] uranusjr commented on a change in pull request #21192: Update `ExternalTaskSensorLink` to handle templated `external_dag_id`

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



##########
File path: airflow/sensors/external_task.py
##########
@@ -40,6 +40,8 @@ class ExternalTaskSensorLink(BaseOperatorLink):
     name = 'External DAG'
 
     def get_link(self, operator, dttm):
+        ti = TaskInstance(task=operator, execution_date=dttm)
+        operator.render_template_fields({"ti": ti})

Review comment:
       Hmm, we should try to discourage creating ad-hoc TaskInstance objects since it is much too brittle now that it has a foreign key to DagRun. Not sure what’s a good alternative though. @ashb Maybe this is a good time to (finally) start working on a new interface for this?
   
   Also instead of just `{"ti": ti}` we should likely use `ti.get_template_context()`.




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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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



[GitHub] [airflow] potiuk commented on pull request #21192: Update `ExternalTaskSensorLink` to handle templated `external_dag_id`

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #21192:
URL: https://github.com/apache/airflow/pull/21192#issuecomment-1030915679


   Just an intermittend docker-compose test failure (which we should take a look soon BTW).


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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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