I am trying to understand how TaskFlow API works and I am starting from this basic DAG:
def _push_argument(ti):
ti.xcom_push(key='p1', value={'param1': 'uno', 'param2': 'due'})
def _print_data(param1, param2):
print(param1)
print(param2)
with DAG(
dag_id='test_airflow_api_dag',
schedule_interval="@daily",
start_date=pendulum.datetime(2022, 1, 1, tz="UTC"),
catchup=False,
default_args=default_args,
tags=["taskapi", "test"],
) as dag:
create_output = PythonOperator(
task_id="create_output",
python_callable=_push_argument
).output
bash_operator_task = PythonOperator(
task_id="bash_operator_task",
python_callable=_print_data,
op_kwargs=create_output
)
I am following a tutorial. The dag, in any case does no work. I receive this error:
[2022-05-31, 12:02:49 UTC] {taskinstance.py:1718} ERROR - Task failed with exception
Traceback (most recent call last):
File "/home/airflow/.local/lib/python3.7/site-packages/airflow/models/taskinstance.py", line 1334, in _run_raw_task
self._execute_task_with_callbacks(context)
File "/home/airflow/.local/lib/python3.7/site-packages/airflow/models/taskinstance.py", line 1460, in _execute_task_with_callbacks
result = self._execute_task(context, self.task)
File "/home/airflow/.local/lib/python3.7/site-packages/airflow/models/taskinstance.py", line 1516, in _execute_task
result = execute_callable(context=context)
File "/home/airflow/.local/lib/python3.7/site-packages/airflow/operators/python.py", line 169, in execute
context.update(self.op_kwargs)
File "/usr/local/lib/python3.7/_collections_abc.py", line 846, in update
for key, value in other:
TypeError: 'NoneType' object is not iterable
What am I wronging? I am following the tutorial at the moment and the code seems the same.