0
0
Apache Airflowdevops~10 mins

Pushing and pulling XCom values in Apache Airflow - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to push an XCom value in an Airflow task.

Apache Airflow
def push_function(ti):
    ti.[1](key='sample_key', value='sample_value')
Drag options to blanks, or click blank then click option'
Apull_xcom
Bpush_xcom
Cxcom_pull
Dxcom_push
Attempts:
3 left
💡 Hint
Common Mistakes
Using pull methods instead of push.
Incorrect method names like push_xcom.
2fill in blank
medium

Complete the code to pull an XCom value inside a task.

Apache Airflow
def pull_function(ti):
    value = ti.[1](key='sample_key', task_ids='push_task')
Drag options to blanks, or click blank then click option'
Axcom_push
Bxcom_pull
Cpull_xcom
Dpush_xcom
Attempts:
3 left
💡 Hint
Common Mistakes
Using push methods instead of pull.
Incorrect method names like pull_xcom.
3fill in blank
hard

Complete the code to push an XCom value in an Airflow task.

Apache Airflow
def push_function(ti):
    ti.[1]('sample_key', 'sample_value')
Drag options to blanks, or click blank then click option'
Axcom_push
Bpush_xcom
Cxcom_pull
Dpush
Attempts:
3 left
💡 Hint
Common Mistakes
Using pull methods instead of push.
Incorrect method names like push_xcom.
4fill in blank
hard

Fill both blanks to push and then pull an XCom value correctly.

Apache Airflow
def task_function(ti):
    ti.[1](key='key1', value='value1')
    pulled_value = ti.[2](key='key1', task_ids='task_function')
Drag options to blanks, or click blank then click option'
Axcom_push
Bxcom_pull
Cpush_xcom
Dpull_xcom
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up push and pull methods.
Using incorrect method names.
5fill in blank
hard

Fill all three blanks to push a value, pull it, and print it inside an Airflow task.

Apache Airflow
def task_function(ti):
    ti.[1](key='my_key', value='my_value')
    value = ti.[2](key='my_key', task_ids='task_function')
    print([3])
Drag options to blanks, or click blank then click option'
Axcom_push
Bxcom_pull
Cvalue
Dmy_value
Attempts:
3 left
💡 Hint
Common Mistakes
Printing the string literal instead of the variable.
Using wrong method names.