nemo_gym.utils.server_process
nemo_gym.utils.server_process
Whether this process is a Gym server worker, and the environment variables that tell it.
The main server process sets these variables before uvicorn starts its workers, so each worker knows its role and the entrypoint it serves.
Module Contents
Functions
Data
IS_NEMO_GYM_FASTAPI_ENTRYPOINT_KEY_NAME
IS_NEMO_GYM_FASTAPI_WORKER_KEY_NAME
API
Whether the module calling this, defined in file, is the entrypoint this worker serves.
uvicorn starts each worker with the spawn method.
Spawn first re-runs the parent’s main script under the name __mp_main__,
and only then does uvicorn import the entrypoint by module name and serve its app.
Gym starts a server by running its entrypoint as the main script, so the __mp_main__ copy is that same file.
This returns False for that copy.
Otherwise each worker would build the server twice:
once in the copy, which nothing serves, before uvicorn’s health check starts answering,
and once for the app it serves.