GitHub user rodigu created a discussion: How to pass data to downstream
`task.branch` task using TaskFlow Syntax?
I am creating a DAG, in which I want to include a branching task.
The branching task will select tasks that should receive data through their
parameters.
Here is a simplification:
```py
@dag
def branching_dag():
@task.branch(task_id='branching_task')
def choose_task(do_a: bool):
if do_a:
return "do_a"
return "do_b"
@task
def a(text: str):
print(text)
def b(text: str):
print(f'{text} but in b')
choose_task(True)
```
How can I pass data to `a` or `b`?
I have read on [Airflow
XComs](https://airflow.apache.org/docs/apache-airflow/stable/core-concepts/xcoms.html),
but the documentation seems a little unclear. Is `task_instance` a variable
that is always available? How should I import or access it using the TaskFlow
API?
GitHub link: https://github.com/apache/airflow/discussions/45003
----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]