Skip to content

Move shared rollout and policy lookup out of policy_runner - #1461

Merged
cvolkcvolk merged 3 commits into
mainfrom
cvolk/refactor/move-shared-code-out-of-policy-runner
Nov 18, 2026
Merged

cvolkcvolk merged 3 commits into
mainfrom
cvolk/refactor/move-shared-code-out-of-policy-runner

Conversation

@cvolkcvolk

@cvolkcvolk cvolkcvolk commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

Move rollout_policy into a new isaaclab_arena/evaluation/rollout.py, and replace get_policy_cls with resolve_policy_type_from_name_or_class_path in arena_experiment_config_loader.py. After this, nothing that experiment_runner.py uses imports policy_runner.py.

Why this change?

We plan to deprecate policy_runner.py in favor of experiment_runner.py. Two modules that experiment_runner.py uses still imported code from it:

  • run_execution.py imported rollout_policy.
  • legacy_eval_config.py imported get_policy_cls to resolve a legacy JSON Experiment's policy.

policy_runner.py could not be deleted without breaking experiment_runner.py.

What changes?

  • rollout_policy moves into isaaclab_arena/evaluation/rollout.py. run_execution.py and policy_runner.py import it from there. The only change to it: it reads env.unwrapped.cfg.metrics without hasattr, because IsaacLabArenaManagerBasedRLEnvCfg always declares metrics.
  • get_policy_cls is replaced by resolve_policy_type_from_name_or_class_path in arena_experiment_config_loader.py. It returns the policy class for a registered name or a dotted class path. _resolve_policy_cfg_type_from_name_or_class_path, which resolves policy.type in typed YAML Experiments, already had the same logic and now calls resolve_policy_type_from_name_or_class_path. legacy_eval_config.py and policy_runner.py also call resolve_policy_type_from_name_or_class_path in place of get_policy_cls.
  • resolve_policy_type_from_name_or_class_path does not print the "Policy ... is not registered. Dynamically importing from path" message that get_policy_cls printed.
  • test_rollout_policy.py targets the new module.

Validation

  • Rebased onto main at 02a9b1e413, after Deprecate multi-GPU evaluation with torchrun #1459. CI passed on the earlier head afc9e006cd.
  • After dropping the hasattr checks: test_rollout_policy.py, test_run_execution.py, and test_experiment_runner.py::test_experiment_runner_from_typed_yaml pass.
  • Locally, in the Arena Docker image built from main:
    • test_rollout_policy.py (2 passed), test_run_execution.py (23), test_arena_experiment_config_loader.py (26), test_policy_cfgs.py (13), test_legacy_eval_config.py (6), and the test_policy_runner.py deprecation test.
    • Subprocess runs that start Isaac Sim: test_policy_runner.py::test_zero_action_policy, test_experiment_runner.py::test_experiment_runner_from_typed_yaml, and test_experiment_runner.py::test_experiment_runner_two_jobs_zero_action (legacy JSON) all pass.
  • pre-commit passes.

@greptile-apps

greptile-apps Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge; no actionable issues were found.

Summary

Moves shared rollout and policy lookup code out of policy_runner.py so experiment execution no longer depends on that runner.

  • Experiment and standalone runs share the same rollout loop.
  • Policy names and dotted paths use one shared lookup.

No actionable issues found. Tests were not run during this review.

Reviews (2) · Last reviewed commit: "Move shared rollout and policy lookup ou..." · Reviewed by Greptile

@arena-review-bot

arena-review-bot Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

🤖 Isaac Lab-Arena Review Bot

Summary

This PR moves rollout_policy unchanged into isaaclab_arena/evaluation/rollout.py and replaces get_policy_cls with resolve_policy_type_from_name_or_class_path in arena_experiment_config_loader.py. After the change, nothing that experiment_runner.py imports pulls in policy_runner.py. Since the last review, the branch was rebased and the repeated Returns: section was removed. The author answered the legacy_eval_config.py duplication comment: that file is due for deletion, so the duplication will go with it.

Findings

No new findings.

Test Coverage and CI Cost

CI for the current head was still running during this review. Pre-commit passed, but "Run tests", "Run tests with subprocess", "Build the docs" and "GR00T closed-loop E2E" were still queued or in progress. I didn't run any tests.

Verdict

Ship it

@cvolkcvolk
cvolkcvolk marked this pull request as draft October 16, 2026 08:39
@cvolkcvolk
cvolkcvolk force-pushed the cvolk/refactor/move-shared-code-out-of-policy-runner branch from c509e09 to 3ebba19 Compare November 17, 2026 12:58
@cvolkcvolk
cvolkcvolk marked this pull request as ready for review November 17, 2026 13:58
@cvolkcvolk

Copy link
Copy Markdown
Collaborator Author

/review

@arena-review-bot

Copy link
Copy Markdown
Contributor

The PR changed while this review was running. Please run /review to retry.

run_execution.py imported rollout_policy from policy_runner.py, and
legacy_eval_config.py imported get_policy_cls from it, so the
Experiment Runner depended on the module we plan to deprecate.

Move rollout_policy unchanged into isaaclab_arena/evaluation/rollout.py.
Replace get_policy_cls with resolve_policy_type_from_name_or_class_path
in arena_experiment_config_loader.py, which the typed YAML policy
resolver already implemented. The YAML loader, legacy JSON
Experiments, and policy_runner.py now share that one lookup.

Signed-off-by: Clemens Volk <[email protected]>
The summary of resolve_policy_type_from_name_or_class_path already
says it returns the policy class.

Signed-off-by: Clemens Volk <[email protected]>
@cvolkcvolk
cvolkcvolk force-pushed the cvolk/refactor/move-shared-code-out-of-policy-runner branch from afc9e00 to 1e774d1 Compare November 18, 2026 09:15

@alexmillane alexmillane left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM. Some tiny (optional) nits

Comment thread isaaclab_arena/evaluation/rollout.py Resolved
IsaacLabArenaManagerBasedRLEnvCfg declares metrics, and the Mimic
config subclasses it, so every environment rollout_policy receives has
the attribute. Check it for None without hasattr.

Signed-off-by: Clemens Volk <[email protected]>
@cvolkcvolk
cvolkcvolk enabled auto-merge (squash) November 18, 2026 10:01
@cvolkcvolk
cvolkcvolk merged commit 2a6ffe1 into main Nov 18, 2026
10 checks passed
cvolkcvolk added a commit that referenced this pull request Nov 18, 2026
Add `import_class_from_path` and use it wherever Arena imports a class
named by a path: the Experiment policy lookup, the GR00T embodiment
adapter lookup, and `--external_environment_class_path`.

Builds on #1461, which moves the policy lookup into
`arena_experiment_config_loader.py`.

## Why this change?

Three places split a class path, imported the module, and read the class
with their own code:

- `resolve_policy_type_from_name_or_class_path` in
`arena_experiment_config_loader.py`, for `policy.type` in Experiments.
- `import_gr00t_embodiment_adapter_class` in
`gr00t_embodiment_adapter.py`, for `gr00t_embodiment_adapter`.
- `parse_and_return_external_environment_from_string` in
`isaaclab_arena_environments/cli.py`, for
`--external_environment_class_path module_path:ClassName`.

Alex suggested a shared helper in the review of #1461.

## What changes?

- `isaaclab_arena/utils/class_path.py` adds
`import_class_from_path(class_path, separator=".")`. It asserts that the
path contains the separator, that the module has the attribute, and that
the attribute is a class, then returns the class.
- The three places above call it. Each keeps its own checks on top, such
as the GR00T adapter's built-in names and its `Gr00tEmbodimentAdapter`
subclass check.
- `--external_environment_class_path` keeps the `module_path:ClassName`
form by passing `separator=":"`. Errors there are now assertions with
the expected form, and a missing module raises the `ModuleNotFoundError`
from the import instead of a `ValueError`.

Isaac Lab's `string_to_callable` also splits a path, but it accepts any
callable, evaluates lambda strings, and its error message always names
the `module:attribute_name` form.

Hydra's `get_class`, used by `_validated_target_class` in
`isaaclab_arena/hydra/config_override.py`, finds the same classes but
gives less useful errors for paths people type by hand. It reports a
misspelled class name as a missing module, and it logs every failure at
ERROR before raising it.

## Validation

Locally in the Arena Docker image built from `main`:

- New `test_class_path.py` (6 passed).
- `test_arena_experiment_config_loader.py` (26 passed), including the
policy class path test.
- `test_gr00t_remote_closedloop_policy.py` without subprocess tests (22
passed), including the adapter error messages.
- `test_external_environment.py` (3 passed): the Isaac Lab callback and
two `policy_runner.py` runs with `--external_environment_class_path`.
- `pre-commit` passes.

---------

Signed-off-by: Clemens Volk <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants