Recall & Review
beginner
What is an XCom in Apache Airflow?
An XCom (short for cross-communication) is a way for tasks in Airflow to exchange small pieces of data or messages during a workflow run.
Click to reveal answer
beginner
How do you return a value from a PythonOperator task to be used by another task?
You return the value from the Python function used in the PythonOperator. Airflow automatically pushes this return value as an XCom.
Click to reveal answer
intermediate
How can a downstream task pull an XCom value returned by an upstream task?
Use the task instance's xcom_pull method with the task_id of the upstream task to get the returned value.
Click to reveal answer
intermediate
What is the default key used when pushing XComs with return values?
The default key is 'return_value' when a task returns a value that Airflow pushes as an XCom.
Click to reveal answer
beginner
Why should XComs be used only for small data?
Because XComs store data in the Airflow metadata database, large data can slow down the system and cause performance issues.
Click to reveal answer
What happens when a PythonOperator's Python function returns a value?
✗ Incorrect
Airflow automatically pushes the returned value as an XCom with the key 'return_value'.
Which method is used to retrieve an XCom value in a task?
✗ Incorrect
The xcom_pull() method is used to retrieve XCom values from other tasks.
What is the recommended size of data to pass via XComs?
✗ Incorrect
XComs are designed for small data pieces to avoid performance issues.
If you want to pass multiple values via XCom, what should you do?
✗ Incorrect
Returning a dictionary or list bundles multiple values into one XCom payload.
Which Airflow component stores XCom data?
✗ Incorrect
XCom data is stored in the Airflow metadata database.
Explain how to pass data from one task to another using XCom return values in Airflow.
Think about how Python functions return values and how Airflow handles them.
You got /3 concepts.
Describe best practices and limitations when using XComs for passing data between tasks.
Consider performance and storage when using XComs.
You got /4 concepts.