nemo_gym.core.failure_transport
nemo_gym.core.failure_transport
Carry FailureReport data between Gym servers and into Collection’s rows.
Flow for one request a Gym server serves:
- The server middleware opens a
RequestFailureLogfor the request. - While the request runs,
observe_failureadds failures that a retry may still recover from (a model attempt), andobserve_replyadds the report each reply from another Gym server forwarded. - When the request ends, the middleware merges the request’s own failure (if it raised) with the log and
sends the result in the
FailureHeader. - The caller’s
raise_boundary_failureraises the rebuilt failure with separate HTTP details;raise_for_statuskeeps the HTTP exception compatibility path. Collection saves the report withFailureReportRow.
Module Contents
Classes
Functions
Data
API
Encode a FailureReport into one reply header and decode it on the other side.
aiohttp’s client rejects a reply whose header line (name and value) is over 8190 bytes, and the caller then
sees an unreadable error instead of the real status and body. A report whose JSON is over MAX_BYTES is
therefore not sent: the header says {"omitted": true}, and every hop above keeps that flag.
The report in headers; None without one. An invalid value is reported as omitted.
The report a terminal stream event carries; None without one. An invalid value is reported as omitted.
The reply headers for report; none when it holds nothing.
The STREAM_FIELD value for report; None when it holds nothing.
The row keys under which Collection saves a FailureReport beside a rollout’s outcome.
report as row fields; none for an empty report.
row with reports merged into its saved report; row’s own failure_id wins.
The report saved in row; an invalid one is reported as omitted, never raised.
Bases: BaseModel
A terminal HTTP retry-loop observation, not proof that every operation or response body was observed.
The failures observed while one server request is served, other than the request’s own failure.
The server middleware opens one per request with capture; code serving the request reaches it through
current, so a retry loop deep in a client can record an attempt without threading it through calls.
A retry loop can fail without end, so the log keeps the first MAX_EVENTS events and counts the events of
every later report in dropped_events; the report is then marked omitted. A report is kept or dropped
whole, so every kept event’s causes stay in the log.
Add report’s events as observations; the log never has a failure_id of its own.
Make a new log current for the request being served.
The log of the request being served, or None outside a Gym server request.
The report for this request’s reply: its own failure (error, None on success) and the log.
Read bounded terminal SSE failure reports without changing the relayed response.
Read an existing capture without copying its entire body or accepting invalid Unicode.
Close the body; an unfinished data line is not complete report evidence.
Retain model-call observations without selecting an enclosing episode failure.
value as a FailureReport. An event whose kind this Gym does not register (a server pinned to another
version) is kept under unregistered:<kind> instead of invalidating the whole report; any other invalid value
still raises.
Record error for the request being served, for example a model attempt a retry may replace.
Record the client’s actual terminal outcome in the existing request observation scope.
Record the report a reply from another Gym server forwarded, success or failure.
error’s explicit cause chain for the reply beside its EpisodeFailure; None without events.
The producer keeps its kind, reason, terminality and stage on the failure; a cause’s kind stays on its event.
Project the explicit Gym cause chain, preserving its origin IDs.
The namespace a forwarded event keeps when its kind is not registered here (a peer on another Gym version).