fix(runtime): honor system Python for all actor environments - #3982
Conversation
|
/ok to test b869b51 |
Signed-off-by: Jeremi Piotrowski <jpiotrowski@nvidia.com>
b869b51 to
799ff4f
Compare
|
/ok to test 799ff4f |
jepio
left a comment
There was a problem hiding this comment.
Agent-team review of PR #3982. Clean, well-scoped bug fix — 3 actors (AsyncTrajectoryCollector, ReplayBuffer, SyncRolloutActor) were hardcoded to raw PY_EXECUTABLES.VLLM instead of the flag-aware VLLM_EXECUTABLE, so they silently ignored NEMO_RL_PY_EXECUTABLES_SYSTEM=1. No bugs found; registry completeness and ModelOpt interaction independently verified. Two low-severity, non-blocking suggestions below (doc + test coverage).
Generated by Claude Code
| PY_EXECUTABLES.SYSTEM if USE_SYSTEM_EXECUTABLE else PY_EXECUTABLES.TRTLLM | ||
| ) | ||
|
|
||
| FSDP_EXECUTABLE = ( |
There was a problem hiding this comment.
nemo_rl/distributed/ray_actor_environment_registry.py:33
1 action item.
NEMO_RL_PY_EXECUTABLES_SYSTEM isn't documented anywhere in the repo outside this PR's description (only referenced in the two registry .py files). This PR expands its effect from generation-only backends to the full training path (FSDP/Automodel/NeMo Gym) plus the async rollout actors, so it's worth a sentence in docs/design-docs/uv.md for future readers.
AI-1
Add a sentence to docs/design-docs/uv.md (around line 43, end of the "Worker Configuration" paragraph) documenting the flag, e.g.:
Setting the
NEMO_RL_PY_EXECUTABLES_SYSTEM=1environment variable overrides most registry entries toPY_EXECUTABLES.SYSTEM, skipping per-actoruvvenv creation when all dependencies are already available in the system Python environment.
| for actor in DEFAULT_EXECUTABLES | ||
| } == dict.fromkeys(DEFAULT_EXECUTABLES, registry.PY_EXECUTABLES.SYSTEM) | ||
| finally: | ||
| _restore_actor_environment_registry(original_registry) |
There was a problem hiding this comment.
tests/unit/distributed/test_ray_actor_environment_registry.py:66
1 action item, optional.
Pre-existing coverage gap (not introduced by this PR): no test guards that the always-PY_EXECUTABLES.SYSTEM actors (DynamoVllmWorker, MathEnvironment, etc.) stay pinned to SYSTEM regardless of the flag. Verified locally in lima (4 passed, 1 warning in 33.90s).
AI-1
Add a parametrized regression test (also needs import pytest added near the top, after import importlib):
| _restore_actor_environment_registry(original_registry) | |
| finally: | |
| _restore_actor_environment_registry(original_registry) | |
| ALWAYS_SYSTEM_EXECUTABLES = [ | |
| "nemo_rl.models.generation.dynamo.dynamo_worker.DynamoVllmWorker", | |
| "nemo_rl.environments.math_environment.MathEnvironment", | |
| "nemo_rl.environments.math_environment.MathMultiRewardEnvironment", | |
| "nemo_rl.environments.vlm_environment.VLMEnvironment", | |
| "nemo_rl.environments.code_environment.CodeEnvironment", | |
| "nemo_rl.environments.reward_model_environment.RewardModelEnvironment", | |
| "nemo_rl.environments.code_jaccard_environment.CodeJaccardEnvironment", | |
| "nemo_rl.environments.games.sliding_puzzle.SlidingPuzzleEnv", | |
| "nemo_rl.environments.tools.retriever.RAGEnvironment", | |
| ] | |
| @pytest.mark.parametrize("system_flag", ["0", "1"]) | |
| def test_always_system_actor_environments_are_unaffected_by_flag( | |
| monkeypatch, system_flag | |
| ): | |
| original_registry = registry.ACTOR_ENVIRONMENT_REGISTRY | |
| try: | |
| with monkeypatch.context() as context: | |
| context.setenv("NEMO_RL_PY_EXECUTABLES_SYSTEM", system_flag) | |
| importlib.reload(registry) | |
| assert { | |
| actor: registry.get_actor_python_env(actor) | |
| for actor in ALWAYS_SYSTEM_EXECUTABLES | |
| } == dict.fromkeys( | |
| ALWAYS_SYSTEM_EXECUTABLES, registry.PY_EXECUTABLES.SYSTEM | |
| ) | |
| finally: | |
| _restore_actor_environment_registry(original_registry) |
|
closing in favor of #4020. |
What does this PR do ?
Makes
NEMO_RL_PY_EXECUTABLES_SYSTEM=1apply to the FSDP, Automodel, NeMo Gym, trajectory collector, replay buffer, and synchronous rollout actor environments. This prevents those actors from creating specialized uv environments when the runtime uses system Python.The default mappings remain unchanged when the flag is disabled. ModelOpt retains its existing independent handling of the system-Python flag.
Issues
N/A
Usage
Set
NEMO_RL_PY_EXECUTABLES_SYSTEM=1when all actor dependencies are available in the system Python environment.Before your PR is "Ready for review"
Pre checks:
Additional Information
Validation in Lima: