evgenyshulman commented on a change in pull request #8805:
URL: https://github.com/apache/airflow/pull/8805#discussion_r422642296
##########
File path: airflow/models/baseoperator.py
##########
@@ -634,6 +651,33 @@ def deps(self) -> Set[BaseTIDep]:
NotPreviouslySkippedDep(),
}
+ def _set_xcomargs_dependencies(self) -> None:
+ """
+ Resolves upstream dependencies of a task. In this way passing an
``XComArg`
+ as value for a template field will result in creating upstream
relation between
+ two tasks.
+
+ **Example**: ::
+
+ with DAG(...):
+ generate_content =
GenerateContentOperator(task_id="generate_content")
+ send_email = EmailOperator(...,
html_content=generate_content.output)
+
+ # This is equivalent to
+ with DAG(...):
+ generate_content =
GenerateContentOperator(task_id="generate_content")
+ send_email = EmailOperator(
+ ..., html_content="{{
task_instance.xcom_pull('generate_content') }}"
+ )
+ generate_content >> send_email
+
+ """
+ from airflow.models.xcom_arg import XComArg
+ for field in self.template_fields:
+ arg = getattr(self, field)
+ if isinstance(arg, XComArg):
+ self.set_upstream(arg.operator)
Review comment:
```
op = PythonOperator( op_kwargs={"a": xarg_value}, op_args=[ xarg_value] )
```
xarg_value will not be resolved into dependencie. Although at .execute xcom
values are going to be used automatically
----------------------------------------------------------------
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:
[email protected]