nemo_gym.h2_ping_sidecar.config
nemo_gym.h2_ping_sidecar.config
Schema for the sidecar: block of a NeMo Gym config.
NVCF endpoints sit behind AWS Global Accelerator, which drops a connection that carries no application data for 340s. Gym’s aiohttp client cannot send HTTP/2 PINGs, so Gym points its model base URLs at a local sidecar that forwards over HTTP/2 and sends the PINGs itself.
This module imports only pydantic, so it is safe to import from Gym’s config machinery.
Module Contents
Classes
Functions
Data
GLOBAL_ACCELERATOR_IDLE_TIMEOUT_SECONDS
LOAD_BALANCER_KEEP_ALIVE_SECONDS
API
Bases: BaseModel
Configuration of the HTTP/2 PING sidecar that gym env start can run.
Path to the compiled h2-ping-sidecar. Defaults to a build in Gym’s cache directory (see
build_if_missing). It only needs to exist on the node that runs gym env start.
Run go build on the launching node when the binary does not exist yet. Needs Go on PATH.
Master switch. When false Gym starts nothing and leaves every URL untouched.
CPU threads the Go runtime may use, passed as GOMAXPROCS. Only needed to cap the Go runtime below the
container’s CPU quota; setting it disables the runtime’s automatic updates.
Soft memory limit for the Go runtime, passed as GOMEMLIMIT (for example 1GiB).
Skip upstream TLS verification. For tests only.
One entry per upstream the sidecar forwards to; required when enabled. A model URL is routed through
an instance when its host matches the instance’s upstream. Give each instance its own listen port.
Directory for h2ping-<instance>-<host>.log. Defaults to nemo_gym_log_dir, then a temp dir.
Retire the upstream connection after 90-100% of this age: in-flight requests finish on it and new
requests use a fresh connection, at the cost of one TLS handshake. Keep it below the load balancer’s
client keep-alive limit (3600s by default) so large bodies never meet its GOAWAY. 0s disables.
Send an HTTP/2 PING after this much read-idle time. Must stay well below 340s.
Close the upstream connection if a PING is not acknowledged within this time.
Request bodies up to this many bytes are buffered in memory so a request refused with a graceful
GOAWAY can be re-sent on a fresh connection. Larger bodies stream through and are not retried. Peak
memory is roughly this limit times the number of concurrent requests. 0 disables buffering.
Rewrite policy_base_url and every *base_url under responses_api_models that points at
an instance’s upstream so it targets that instance’s local address instead.
On shutdown, let in-flight requests finish for up to this long before the sidecar exits.
Wait this long for each sidecar to bind its port before failing the run.
Bases: BaseModel
One proxy: a loopback listener that forwards to a single HTTPS upstream.
host:port the sidecar binds. Keep it on loopback: the sidecar adds no authentication.
Used in log file names and error messages.
HTTPS URL to forward to. Only scheme://host[:port] is used; a path such as /v1 is
dropped, because clients keep sending it on every request.
Whether host (a name or IP literal, optionally in brackets) only accepts local connections.
Seconds in a Go-style duration such as 60s, 15m or 1m30s.
scheme://host[:port] of an https URL; raises ValueError for anything else.