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/29 06:38:08 UTC

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

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