nemo_gym.server_runtime.request_handling.exception_handling
nemo_gym.server_runtime.request_handling.exception_handling
Middleware that answers a failed request and reports every request’s failures in its reply.
Module Contents
Classes
Functions
API
Answer a request whose route failed before replying, and send each reply with its failure report.
A route that raises, or returns without replying, gets failure_reply’s response.
That response keeps the partial observations the route left in the request state.
Every reply, successful or not, carries the failures observed while serving it in its failure header.
Once a reply has started, its status is already sent, so a later failure propagates.
A cancelled request still gets the failure reply, and then the cancellation propagates to whoever cancelled the
task.
Put report in a reply’s failure header, merged with any report the reply already carries.
Whether error is the cancellation of the task serving this request.
Gym cancels that task when a client disconnects, when a checkpoint retires an activation or a model call, and when uvicorn shuts down.