Skip to content

Move Ray tooling to isaaclab_contrib - #7238

Open
kellyguo11 wants to merge 2 commits into
isaac-sim:mainfrom
kellyguo11:codex/pr-7134-ray
Open

kellyguo11 wants to merge 2 commits into
isaac-sim:mainfrom
kellyguo11:codex/pr-7134-ray

Conversation

@kellyguo11

@kellyguo11 kellyguo11 commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Moved the community Ray dispatch and tuning workflow into isaaclab_contrib.rl.ray, with an opt-in checkout ray extra and packaged Kubernetes templates. The legacy scripts, module imports, tuning configuration paths, Dockerfile, and cluster template paths remain usable for one deprecation release.

Merged current main (5c40dd797b) into the original PR head, preserving its history and the current uv-based launch commands. The separate documentation cleanup was merged in #7237.

Compatibility and workflow fixes

  • Registered forwarded modules as __main__ during execution so the legacy MLflow converter can pickle its process-pool workers.
  • Preserved the legacy job upload directory, including adjacent user task YAML files and Python modules. Added --working_dir to the module command for explicit job directories.
  • Preserved both script execution and namespace imports of legacy modules, plus the old tuning configuration and cluster resource paths.
  • Disabled Ray's automatic uv environment upload before Ray is imported, following the prepared-cluster model used by RLinf. This avoids duplicating the checkout/environment and allows per-job dependencies.
  • Propagated failed worker commands and failed aggregate submissions to the caller, with stderr/logs, rather than reporting successful completion. Drained subprocess stderr while reading stdout.
  • Fixed manual resource wrapping to honor explicit CPU/GPU/memory allocations, including zero-GPU tasks, without conflicting with the default worker count.
  • Updated current documentation/navigation, the dependency lock, package data, Docker dependency installation, and changelog fragments.

Validation

Validated on Linux with Python 3.12, Ray 2.52.1, Optuna 4.9.0, MLflow 3.18.0, and Torch 2.11.0. The worktree used its own uv environment and package registrations, with existing simulator dependencies reused read-only; this was not a clean full simulator installation.

  • uv run --no-sync python -m pytest source/isaaclab_contrib/test/rl/test_ray_compat.py -q: 4 passed. Regression cases were observed failing before their fixes: process-pool conversion, legacy upload/failure propagation, failed worker commands, and explicit resource allocation.
  • uv run --no-sync python -m pytest source/isaaclab/test/cli/test_uv_run_pyproject.py -q: 13 passed.
  • All 7 module entry points and 7 legacy scripts passed --help; legacy namespace/configuration imports also passed.
  • Real isolated local Ray cluster: independent and simultaneous/batch dispatch each ran two CPU tasks using uploaded Python modules and verified their output files.
  • Resource wrapping: worker-count dispatch and explicit CPU/GPU/memory allocation both executed real CPU commands; a failing command produced a nonzero CLI exit.
  • Real Ray Jobs API: uploaded a directory containing a legacy runner, task YAML, and a user Python module, executed the job, and verified its output file.
  • Real Tune CLI: Optuna launched the actual IsaacLabTuneTrainable against a synthetic CPU trainer emitting TensorBoard metrics. The trial reached TERMINATED, reported reward 13.5, and exercised the custom stopper/process-cleanup path.
  • MLflow regression created a SQLite-backed experiment, converted a run through the legacy CLI's real process pool, and verified the resulting TensorBoard metric value and step.
  • Final contrib wheel built successfully; its Dockerfile and Kubernetes Jinja template were present. The packaged KubeRay template rendered valid YAML.
  • Documentation navigation/redirect and all 16 Ray guide literal includes resolved.
  • uv lock --check, changelog validation against origin/main, git diff --check, and the full uv run --no-sync isaaclab --format gate passed.

Validation limits

The NVIDIA driver was unavailable. CPU checks advertised one logical GPU resource solely to exercise Ray's resource scheduling; no CUDA or simulator training was performed. Tune used a synthetic trainer, not an Isaac Lab environment. Docker image execution, live Kubernetes/GKE provisioning, remote multi-node execution, and remote MLflow-backed tuning remain unvalidated.

CI status after this update

  • GitHub reports the branch merges cleanly with current main.
  • Pre-commit and changelog checks passed.
  • Docker/GPU CI was activated for the updated head and is running. The initial automatically triggered Docker run stopped at the missing-activation gate, before building or testing.
  • Docs CI failed before parsing the Ray guide: the environment-browser generator could not import newton.
  • Link checking found a 404 for the G1 motion-tracking preview environments/previews/locomotion/g1_cr7.mp4 in the unchanged motion-tracking guide. It reported no broken Ray guide links.

These CI failures have not been represented as successful validation or fixed as part of this Ray migration. Remaining build/platform jobs were still pending when this report was updated.

@github-actions github-actions Bot added documentation Improvements or additions to documentation isaac-lab Related to Isaac Lab team infrastructure labels Aug 21, 2026
@kellyguo11
kellyguo11 marked this pull request as ready for review August 21, 2026 06:06
@kellyguo11
kellyguo11 requested a review from a team August 21, 2026 06:06
@greptile-apps

greptile-apps Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR relocates the community Ray dispatch and tuning workflow into isaaclab_contrib while retaining deprecated forwarding scripts.

  • Adds the root ray dependency extra and packages the cluster templates.
  • Updates Ray commands, installation guidance, lockfile metadata tests, and changelog fragments.
  • Leaves the documentation toctree pointing to the removed Ray page path.

Confidence Score: 4/5

The implementation appears largely sound, but the stale Sphinx toctree must be corrected before merging to avoid a broken documentation build and missing Ray page.

Moving the Ray document without updating docs/index.rst leaves the documentation graph referencing a nonexistent source file.

Files Needing Attention: docs/source/experimental-features/ray.rst and docs/index.rst

Important Files Changed

Filename Overview
source/isaaclab_contrib/isaaclab_contrib/rl/ray/submit_job.py Moves Ray job submission into the contrib package and uploads the relocated package directory as the remote working directory.
source/isaaclab_contrib/isaaclab_contrib/rl/ray/tuner.py Relocates the tuning entrypoint and updates package imports while retaining local and remote workflow path handling.
scripts/reinforcement_learning/ray/_compat.py Adds common deprecation and forwarding behavior for the legacy script entrypoints.
source/isaaclab_contrib/pyproject.toml Includes the Ray Dockerfile and Jinja Kubernetes template as package data.
pyproject.toml Adds the opt-in Ray, tuning, Kubernetes, and MLflow dependency group.
docs/source/experimental-features/ray.rst Relocates and updates the Ray guide, but the root documentation toctree still references its removed path.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  User[Ray CLI user] --> Extra[uv --extra ray]
  Extra --> Contrib[isaaclab_contrib.rl.ray modules]
  Legacy[Deprecated scripts/reinforcement_learning/ray wrappers] --> Contrib
  Contrib --> Local[Local tuning workflow]
  Contrib --> Submit[Ray JobSubmissionClient]
  Submit --> Cluster[Remote Ray or KubeRay cluster]
Loading

Reviews (1): Last reviewed commit: "Move Ray tooling to isaaclab_contrib" | Re-trigger Greptile

@@ -1,8 +1,10 @@
.. _ray-workflow:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Relocated page breaks Sphinx toctree

The document now lives under source/experimental-features/ray, while docs/index.rst still includes the removed source/features/ray path, causing Sphinx to omit this page and warning-as-error documentation builds to fail.

@isaaclab-review-bot isaaclab-review-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isaac Lab Review Bot

The Ray workflow relocation, package-data integration, documentation paths, and deprecated entry points are generally coherent. Two concrete legacy-path compatibility gaps remain: multiprocessing functions executed through the forwarding shim are not exposed through sys.modules["__main__"], and forwarded submit_job.py invocations now upload the contrib directory rather than files beside the legacy scripts.

  • Design and architecture: Moving the workflow under isaaclab_contrib.rl.ray and replacing local sys.path manipulation with package imports is a sound design. The packaged Kubernetes templates and one-release forwarding wrappers provide an appropriate migration structure; the lockfile changes do not by themselves demonstrate an incompatibility for unrelated extras.
  • API: The relocated CLI surfaces and new ray extra are documented and represented in metadata tests. However, the deprecated submit_job.py path no longer preserves the old Ray working_dir behavior: relative task configuration or Python-module files placed beside the legacy scripts are not uploaded. The migration warning or changelog must state that these files need relocation, or the wrapper must preserve the old working-directory contract.
  • Implementation: The forwarding helper works for ordinary module execution and imports, but runpy.run_module(..., run_name="__main__") leaves the legacy wrapper registered as sys.modules["__main__"]. The MLflow converter submits a function defined by the forwarded module to ProcessPoolExecutor, so that function cannot be resolved from the registered wrapper during pickling. The forwarding path should temporarily register the executed module as __main__, such as by using alter_sys=True.

Minor fixes needed. Posted 2 actionable findings inline.

Automated review; human maintainers own approval decisions.

stacklevel=2,
)
if namespace.get("__name__") == "__main__":
runpy.run_module(module_name, run_name="__main__")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Implementation — Forwarding shim breaks multiprocessing pickling

runpy.run_module(..., run_name="__main__") defaults to alter_sys=False, so sys.modules["__main__"] stays the legacy wrapper. mlflow_to_local_tensorboard submits process_run (whose __module__ is "__main__") to a ProcessPoolExecutor; pickling resolves it against the wrapper, which lacks that attribute, so the legacy script fails at runtime while --help still succeeds. Pass alter_sys=True.

print(f"[INFO]: Isaac Ray Wrapper received jobs {formatted_jobs=}")
clusters = read_cluster_spec(args.config_file)
submit_jobs_to_clusters(formatted_jobs, clusters)
forward("isaaclab_contrib.rl.ray.submit_job", globals())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Suggestion · Api — Wrapper changes uploaded Ray working_dir

The forwarded module derives CONFIG["working_dir"] from its own __file__, so the uploaded runtime-env directory becomes the contrib package path. Users invoking this deprecated script with relative --task_cfg tasks.yaml or --py_modules files placed next to the old scripts no longer have those files uploaded, and the cluster job fails. State the required relocation in the deprecation warning or changelog fragment.

@AntoineRichard

Copy link
Copy Markdown
Collaborator

This is a lot of diff, did we test all this?

@AntoineRichard AntoineRichard added the ci:run-docker Trigger the on-demand Docker and GPU CI workflow label Nov 23, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:run-docker Trigger the on-demand Docker and GPU CI workflow documentation Improvements or additions to documentation infrastructure isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants