-
Notifications
You must be signed in to change notification settings - Fork 14.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Xcom pull is failing when is key is None #46417
Comments
Nice observation. Will pick it up soon |
I'd almost argue that explicitly passing (Because passing None as an argument is different to not passing the argument.) |
Yeah I agree with you too @ashb. But the qn is, to retain the behaviour similar to earlier, we have two choices now:
|
@vatsrahul1001 @ashb do you have any inputs on the above comment? |
I agree with @ashb on this; the chances of someone passing |
I think we should disallow both None and an empty string, they are not useful in practice (you just get an undeterministic XCom associated to the task). We should also add a fix to 2.x for this, likely in get_one. |
Closing this one in favour of Disallow using an empty key in XCom pull |
Apache Airflow version
3.0.0a1
If "Other Airflow 2 version" selected, which one?
No response
What happened?
pulled_value_1 = ti.xcom_pull(key=None, task_ids="push")
in failing in AF3, however, same code works with2.10.4
. Looks like when I provide the key it works fine. I am raising this issue as there is a deviation of behaviour from AF2 here. Maybe we can handle this in task-sdk3.0.0a1
2.10.4
{"timestamp":"2025-02-04T11:01:20.886364","level":"error","event":"Task failed with exception","logger":"task","error_detail":[{"exc_type":"ValidationError","exc_value":"1 validation error for GetXCom\nkey\n Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]\n For further information visit [https://errors.pydantic.dev/2.10/v/string_type","syntax_error":null,"is_cause":false,"frames":[](https://errors.pydantic.dev/2.10/v/string_type%22,%22syntax_error%22:null,%22is_cause%22:false,%22frames%22:[){"filename":"/opt/airflow/task_sdk/src/airflow/sdk/execution_time/task_runner.py","lineno":545,"name":"run"},{"filename":"/opt/airflow/task_sdk/src/airflow/sdk/execution_time/task_runner.py","lineno":645,"name":"_execute_task"},{"filename":"/opt/airflow/airflow/models/baseoperator.py","lineno":173,"name":"wrapper"},{"filename":"/opt/airflow/providers/standard/src/airflow/providers/standard/operators/python.py","lineno":196,"name":"execute"},{"filename":"/opt/airflow/providers/standard/src/airflow/providers/standard/operators/python.py","lineno":222,"name":"execute_callable"},{"filename":"/opt/airflow/airflow/utils/operator_helpers.py","lineno":261,"name":"run"},{"filename":"/files/dags/example_xcom.py","lineno":34,"name":"puller"},{"filename":"/opt/airflow/task_sdk/src/airflow/sdk/execution_time/task_runner.py","lineno":266,"name":"xcom_pull"},{"filename":"/usr/local/lib/python3.9/site-packages/pydantic/main.py","lineno":214,"name":"__init__"}]}]}
What you think should happen instead?
Same code working in AF2 should work in AF3 as well
How to reproduce
Use below DAG to replicate
DAG CODE
Operating System
Linux
Versions of Apache Airflow Providers
No response
Deployment
Other
Deployment details
No response
Anything else?
No response
Are you willing to submit PR?
Code of Conduct
The text was updated successfully, but these errors were encountered: