Skip to content
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

Improve error handling and logging in CommsDecoder interface #46426

Open
ashb opened this issue Feb 4, 2025 · 0 comments
Open

Improve error handling and logging in CommsDecoder interface #46426

ashb opened this issue Feb 4, 2025 · 0 comments

Comments

@ashb
Copy link
Member

ashb commented Feb 4, 2025

Resurrect #45927 and extend it.

Every request should have a response that the client reads.

We need the ability to pass/send errors from Supervisor to the task code (for instance if there is an error performing an action, or if the XCom can't be found) -- right now each end point handles this itself in a different way.

except ServerResponseError as e:
if e.response.status_code == HTTPStatus.NOT_FOUND:
log.error(
"XCom not found",
dag_id=dag_id,
run_id=run_id,
task_id=task_id,
key=key,
map_index=map_index,
detail=e.detail,
status_code=e.response.status_code,
)
# Airflow 2.x just ignores the absence of an XCom and moves on with a return value of None
# Hence returning with key as `key` and value as `None`, so that the message is sent back to task runner
# and the default value of None in xcom_pull is used.
return XComResponse(key=key, value=None)
for example shouldn't be handled in the API Client, but it should expose/raise the 404 to the Task itself and it should be handled there

@ashb ashb converted this from a draft issue Feb 4, 2025
@dosubot dosubot bot added the area:logging label Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant