Coverage for airflow.example_dags.example_xcom : 59%
Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
|
'example_xcom', start_date=datetime.datetime(2015, 1, 1), default_args={'owner': 'airflow', 'provide_context': True})
# pushes an XCom without a specific target kwargs['ti'].xcom_push(key='value from pusher 1', value=value_1)
# pushes an XCom without a specific target, just by returning it return value_2
ti = kwargs['ti']
# get value_1 v1 = ti.xcom_pull(key=None, task_ids='push') assert v1 == value_1
# get value_2 v2 = ti.xcom_pull(task_ids='push_by_returning') assert v2 == value_2
# get both value_1 and value_2 v1, v2 = ti.xcom_pull(key=None, task_ids=['push', 'push_by_returning']) assert (v1, v2) == (value_1, value_2)
task_id='push', dag=dag, python_callable=push)
task_id='push_by_returning', dag=dag, python_callable=push_by_returning)
task_id='puller', dag=dag, python_callable=puller)
|