Challenge - 5 Problems
XCom Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate1:30remaining
What is the output of pulling an XCom value?
Given a task pushes an XCom value with key 'result' and value 42, what will be the output of pulling this XCom in another task?
Apache Airflow
value = ti.xcom_pull(task_ids='push_task', key='result') print(value)
Attempts:
2 left
💡 Hint
Remember that xcom_pull returns the value pushed with the matching key and task_id.
✗ Incorrect
The ti.xcom_pull method retrieves the value pushed by the specified task and key. Since the value 42 was pushed with key 'result', pulling it returns 42.
🧠 Conceptual
intermediate1:00remaining
Which method is used to push an XCom value in Airflow?
You want to share data from one task to another using XComs. Which method should you use inside a task to push a value?
Attempts:
2 left
💡 Hint
The method is called on the task instance object (ti).
✗ Incorrect
The correct method to push an XCom value is ti.xcom_push(). It takes a key and a value to store.
❓ Troubleshoot
advanced2:00remaining
Why does xcom_pull return None unexpectedly?
You have two tasks: 'push_task' pushes an XCom with key 'data'. 'pull_task' tries to pull it but gets None. What is a likely cause?
Attempts:
2 left
💡 Hint
Consider timing, spelling, and whether the push actually happened.
✗ Incorrect
All these reasons can cause ti.xcom_pull to return None: pulling before push, wrong key, or no push call.
🔀 Workflow
advanced2:30remaining
Order of operations for pushing and pulling XComs
Arrange the steps in the correct order to share data between two Airflow tasks using XComs.
Attempts:
2 left
💡 Hint
Pushing happens during Task A execution, which must complete before Task B runs and pulls.
✗ Incorrect
Task A pushes the value (1), then completes (3). Task B runs after Task A (4) and pulls the value (2).
✅ Best Practice
expert3:00remaining
What is the recommended way to avoid XCom data size issues?
XComs have size limits. Which approach is best to handle large data sharing between tasks?
Attempts:
2 left
💡 Hint
Think about scalability and Airflow best practices.
✗ Incorrect
Best practice is to store large data outside Airflow (e.g., S3, database) and push only a pointer or filename via XCom to avoid database bloat and performance issues.