A. xcom_pull requires a different method signature
B. The task_ids parameter is incorrect
C. The key used in xcom_pull does not match the key used in xcom_push
D. xcom_push cannot send strings
Solution
Step 1: Compare keys used in push and pull
task_a pushes with key 'data', but task_b pulls with key 'result'. This mismatch causes None to be returned.
Step 2: Verify other parameters
task_ids is correct, xcom_push supports strings, and method signature is valid.
Final Answer:
The key used in xcom_pull does not match the key used in xcom_push -> Option C
Quick Check:
Matching keys needed for XCom data [OK]
Hint: Keys must match exactly in push and pull [OK]
Common Mistakes:
Ignoring key name mismatch
Assuming xcom_push can't send strings
Changing task_ids unnecessarily
5. You want to pass a list of numbers from task_a to task_b using XCom. Which approach correctly enables this communication?
hard
A. In task_a: ti.xcom_push(key='numbers', value=[1, 2, 3]) In task_b: nums = ti.xcom_pull(key='numbers', task_ids='task_a')
B. In task_a: ti.xcom_push(key='numbers', value='1,2,3') In task_b: nums = ti.xcom_pull(key='numbers', task_ids='task_b')
C. In task_a: ti.xcom_push(key='data', value=[1, 2, 3]) In task_b: nums = ti.xcom_pull(key='numbers', task_ids='task_a')
D. In task_a: ti.xcom_push(value=[1, 2, 3]) In task_b: nums = ti.xcom_pull(key='numbers', task_ids='task_a')
Solution
Step 1: Check key and value consistency
In task_a: ti.xcom_push(key='numbers', value=[1, 2, 3]) In task_b: nums = ti.xcom_pull(key='numbers', task_ids='task_a') uses the same key 'numbers' in push and pull, and passes a list correctly.
Step 2: Verify task_ids and value types
Other options fail: one pushes a string '1,2,3' instead of list and pulls from wrong task_id 'task_b'; another mismatches keys 'data' vs 'numbers'; another omits key in push (defaults to 'return_value') but uses key='numbers' in pull.
Final Answer:
In task_a: ti.xcom_push(key='numbers', value=[1, 2, 3]) In task_b: nums = ti.xcom_pull(key='numbers', task_ids='task_a') -> Option A
Quick Check:
Matching keys and task_ids with correct value type [OK]
Hint: Use same key and task_id, push list directly [OK]
Common Mistakes:
Mismatching keys between push and pull
Pulling from wrong task_id
Omitting key parameter in push or pull
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.