Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using pull methods instead of push.
Incorrect method names like push_xcom.
✗ Incorrect
The method xcom_push is used to push a value to XCom in Airflow.
2fill in blank
mediumComplete 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using push methods instead of pull.
Incorrect method names like pull_xcom.
✗ Incorrect
The method xcom_pull is used to retrieve a value from XCom in Airflow.
3fill in blank
hardComplete 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using pull methods instead of push.
Incorrect method names like push_xcom.
✗ Incorrect
The method xcom_push is used to push a value to XCom in Airflow.
4fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up push and pull methods.
Using incorrect method names.
✗ Incorrect
Use xcom_push to push and xcom_pull to pull XCom values.
5fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Printing the string literal instead of the variable.
Using wrong method names.
✗ Incorrect
Push with xcom_push, pull with xcom_pull, then print the pulled variable value.