Skip to content

Improve error handling and logging in CommsDecoder interface #46426

@ashb

Description

@ashb

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

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Icebox

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions