Fix Task SDK silently ignoring AirflowRuntimeError when Variable.set() or Variable.delete() fails#68542
Conversation
746769a to
e5390fd
Compare
|
@ashb, @kaxil, @amoghrajesh could you please review this? Thanks! |
|
Please show what the task logs look like with this change. I suspect this results in the error being logged twice, and instead were shots remove the try/except block entirely |
|
@ashb This is how it looks on
And this is how it looks like after raising the exception when encountering errors with set and delete:
I can see the error being logged twice and this is how it looks after removing try-except blocks from
Do you want me to push the changes by removing try-except blocks for |
I think its nicer. Do you? |
Yes. I've pushed the changes. |



Closes #68537
As per the issue,
Variable.set()andVariable.delete()in the Task SDK were silently ignoring AirflowRuntimeError, logging the exception but not re-raising, causing tasks to report success even when a variable write was rejected by the Execution API.Addedraiseto both except blocks so errors now propagate and fail the task, consistent with the existing behavior ofVariable.get().Removed
try-exceptblocks forset()anddelete()methods as they are logging the error message twice.Also added the unit test:
test_var_delete- basic success-path coverage forVariable.delete(), which was previously untested.Here's a DAG for testing:
Use the following middleware plugin with breeze to test 403 API errors
Was generative AI tooling used to co-author this PR?
[X] Yes
Used Claude to generate the middleware plugin to test 403 API errors.