0
0
Apache Airflowdevops~10 mins

Why XCom enables task communication in Apache Airflow - Test Your Understanding

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

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

Apache Airflow
ti.[1](key='sample_key', value='hello')
Drag options to blanks, or click blank then click option'
Axcom_push
Bpush_xcom
Csend
Dpull
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'pull' instead of 'xcom_push' to send data.
Using incorrect method names like 'push_xcom'.
2fill in blank
medium

Complete the code to pull a value from XCom in an Airflow task.

Apache Airflow
value = ti.[1](key='sample_key', task_ids='task_a')
Drag options to blanks, or click blank then click option'
Axcom_push
Bpull_xcom
Cxcom_pull
Dget
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'xcom_push' instead of 'xcom_pull' to get data.
Using incorrect method names like 'pull_xcom'.
3fill in blank
hard

Fix the error in the code to correctly pull XCom data from a specific task.

Apache Airflow
result = ti.xcom_pull(key=[1], task_ids='task_b')
Drag options to blanks, or click blank then click option'
A'result_key'
Bresult_key
C['result_key']
D"result_key"
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the key without quotes causing a NameError.
Passing the key as a list instead of a string.
4fill in blank
hard

Fill both blanks to push and then pull a value using XCom in Airflow.

Apache Airflow
ti.[1](key='data', value=42)
retrieved = ti.[2](key='data', task_ids='task_c')
Drag options to blanks, or click blank then click option'
Axcom_push
Bxcom_pull
Cpush
Dpull
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up push and pull methods.
Using non-existent methods like 'push' or 'pull' alone.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that pulls XCom values greater than 10.

Apache Airflow
results = {task_id: ti.[1](key='value', task_ids=task_id) for task_id in tasks if ti.[2](key='value', task_ids=task_id) [3] 10}
Drag options to blanks, or click blank then click option'
Axcom_pull
C>
D<
Attempts:
3 left
💡 Hint
Common Mistakes
Using different methods for pulling data in the comprehension.
Using '<' instead of '>' for filtering.