Skip to navigation

nemo_gym.server_runtime.request_handling.rollout_context

View as Markdown

The middleware that strips a rollout prefix from a request path and sets the current episode for the request.

Tracking the current episode lives in nemo_gym.core.episode_context.

Module Contents

Classes

NameDescription
RolloutContextMiddlewareStrip a rollout prefix and expose it to downstream Gym calls for this request.

Functions

NameDescription
scope_with_routed_pathCopy the scope for routing and share the rewritten path with outer middleware.

Data

ROUTED_PATH_STATE_KEY

__getattr__

API

class nemo_gym.server_runtime.request_handling.rollout_context.RolloutContextMiddleware(
app: typing.Any
)

Strip a rollout prefix and expose it to downstream Gym calls for this request.

_PREFIX
nemo_gym.server_runtime.request_handling.rollout_context.RolloutContextMiddleware.__call__(
scope: dict[str, typing.Any],
receive: typing.Any,
send: typing.Any
) -> None
async
nemo_gym.server_runtime.request_handling.rollout_context.scope_with_routed_path(
scope: dict[str, typing.Any],
path: str
) -> dict[str, typing.Any]

Copy the scope for routing and share the rewritten path with outer middleware.

nemo_gym.server_runtime.request_handling.rollout_context.ROUTED_PATH_STATE_KEY = 'nemo_gym.routed_path'
nemo_gym.server_runtime.request_handling.rollout_context.__getattr__ = moved_names_getattr(__name__)