Skip to content

Add typed YAML experiment composition - #873

Merged
cvolkcvolk merged 8 commits into
mainfrom
cvolk/refactor/hydra-experiment-composition
Jul 9, 2026
Merged

cvolkcvolk merged 8 commits into
mainfrom
cvolk/refactor/hydra-experiment-composition

Conversation

@cvolkcvolk

@cvolkcvolk cvolkcvolk commented Jul 8, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Add typed YAML composition for Arena Experiments as the next step in replacing argparse namespaces and legacy JSON evaluation jobs with strongly typed configuration.

A follow-up connects this loader to eval_runner.py before the JSON path is deprecated and removed.

Detailed description

  • Build on Remove legacy evaluation job model #871’s runtime model: an Arena Experiment is an ordered list of typed Runs
  • Transition experiment definitions to YAML because it fits the configuration hierarchy directly. Ports getting_started_experiment.yaml.
  • Use Hydra as the composition layer, rather than merely as a YAML parser. Hydra selects and constructs the concrete typed environment and policy configs, rejects unsupported.
  • Load each YAML Run into an ArenaRunCfg, composing its concrete environment and policy configurations through an encapsulated Hydra integration.
  • Keep eval_runner and legacy JSON handling unchanged in this PR

@cvolkcvolk
cvolkcvolk marked this pull request as ready for review July 8, 2026 13:25
@arena-review-bot

Copy link
Copy Markdown
Contributor

🤖 Isaac Lab-Arena Review Bot

Summary

This PR adds a typed YAML → ArenaExperiment composition path built on Hydra: each YAML Run selects concrete environment/policy config classes by a type selector (from caller-supplied mappings) and composes them into a typed ArenaRunCfg, with Hydra overrides applied after YAML values. The layering is clean — the loader is sim-agnostic, keeps vendor/robot specifics out of core (the type registry is passed in, not hardcoded), and leaves eval_runner/legacy JSON untouched as stated. Well-scoped and thoroughly tested.

Findings

🔵 Improvement: isaaclab_arena/hydra/arena_experiment.py:56 — Temporary Hydra schemas are stored into the process-global ConfigStore.instance() under a fresh uuid4 namespace on every call and never removed, so the store accumulates unboundedly across repeated loads. variations_hydra.py avoids this by reusing a fixed name that overwrites in place. Consider clearing the entries after composing (or using deterministic names) — the uuid4 is essentially a workaround for not cleaning up. Non-blocking.

Test Coverage

Good. Non-sim composition tests run in Phase 1 (no marker, correct) and cover: full getting-started experiment, YAML order + override precedence, and rejection of unknown types, missing/duplicate names, unknown fields, and unknown overrides. The one sim test (test_getting_started_experiment_executes_baseline_run) correctly uses the inner/outer run_simulation_app_function pattern with deferred imports, headless + no cameras → Phase 1. Assertions are substantive (exact configs, env counts, step limits), not just "no exception raised".

Verdict

Ship it — one optional cleanup (ConfigStore hygiene) to consider before merge.

@greptile-apps

greptile-apps Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR introduces typed YAML composition for Arena Experiments using Hydra as the composition layer. Each YAML runs entry is loaded into an ArenaRunCfg via a two-phase approach: each run is composed individually (resolving its concrete environment and policy types), then the full experiment is re-composed with any caller-supplied Hydra overrides applied on top.

  • isaaclab_arena/hydra/arena_experiment.py — core loader that validates the YAML envelope, resolves type selectors against caller-supplied registries, and uses UUID-namespaced ConfigStore entries to avoid collision between experiments.
  • isaaclab_arena/evaluation/arena_experiment.py — thin TypeAlias (ArenaExperiment = list[ArenaRunCfg]).
  • getting_started_experiment.yaml — four-run reference experiment covering baseline, object swap, HDR change, and parallel-env scaling; also serves as the integration test fixture.

Confidence Score: 3/5

The loader is functionally sound for the primary single-process, single-experiment use case, but the GlobalHydra interaction with variations_hydra introduces a real breakage path when both modules are active in the same process.

The nullcontext() path reuses whatever Hydra context the caller holds, while variations_hydra.compose_variations_cfg_and_apply_overrides unconditionally calls GlobalHydra.instance().clear(). Any eval pipeline that loads an experiment and then processes variations would hit an initialize/clear conflict mid-composition. The assert-based validation also means all YAML checks vanish under -O, and the ConfigStore accumulates without bound across calls.

isaaclab_arena/hydra/arena_experiment.py — specifically the nullcontext() GlobalHydra reuse strategy and its interaction with variations_hydra.py's unconditional clear() call.

Important Files Changed

Filename Overview
isaaclab_arena/hydra/arena_experiment.py Core loader: introduces the double-composition pattern (per-run compose, then experiment-level overrides), GlobalHydra reuse via nullcontext that is incompatible with variations_hydra's clear() strategy, assert-based validation disabled by -O, and unbounded ConfigStore accumulation.
isaaclab_arena/evaluation/arena_experiment.py Thin TypeAlias: defines ArenaExperiment as list[ArenaRunCfg]. Clean, no issues.
isaaclab_arena/hydra/init.py Empty package init with license header only.
isaaclab_arena/tests/test_experiment_hydra.py Good coverage across happy path, overrides precedence, and error cases; test contracts depend on AssertionError being raised by assert statements (disabled under -O).
isaaclab_arena/variations/variations_hydra.py Only adds a TODO comment; no behavioral change. The pre-existing GlobalHydra.clear() call remains and is the source of the interaction hazard with the new nullcontext() path.
isaaclab_arena_environments/experiment_configs/getting_started_experiment.yaml New getting-started experiment config with 4 runs; structure matches the expected schema. run 04_parallel_envs intentionally omits hdr, testing default resolution.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["load_arena_experiment_from_yaml(yaml_path, env_types, policy_types, overrides)"] --> B["_read_and_validate_yaml_run_values(yaml_path)"]
    B --> B1["OmegaConf.load(path)"]
    B1 --> B2["Validate envelope: runs list, no unknown fields, no duplicate names"]
    B2 --> B3["Return: dict[run_name → raw YAML values]"]
    B3 --> C{GlobalHydra initialized?}
    C -->|Yes| D["nullcontext()"]
    C -->|No| E["initialize(config_path=None)"]
    D & E --> F["with composition_context"]
    F --> G["For each run: _compose_arena_run_from_yaml_values"]
    G --> G1["Pop environment_values, policy_values from run_values"]
    G1 --> G2["_compose_typed_config_from_yaml_selector(env_values, env_cfg_types)"]
    G1 --> G3["_compose_typed_config_from_yaml_selector(policy_values, policy_cfg_types)"]
    G2 & G3 --> G4["Validate type selector → resolve concrete cfg class"]
    G4 --> G5["ConfigStore.store(schema=cfg_type)\nConfigStore.store(node=defaults+values)"]
    G5 --> G6["compose() → OmegaConf.to_object() → typed cfg instance"]
    G6 --> H["ConfigStore.store(schema=ArenaRunCfg)\nConfigStore.store(run node with remaining_values)"]
    H --> H1["compose() → OmegaConf.to_object() → ArenaRunCfg"]
    H1 --> I["Collect all runs into arena_runs_by_name dict"]
    I --> J["ConfigStore.store(root node: runs by name)"]
    J --> K["compose(root, overrides=overrides) → apply experiment-level overrides"]
    K --> L["OmegaConf.to_object per run → final ArenaExperiment list"]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A["load_arena_experiment_from_yaml(yaml_path, env_types, policy_types, overrides)"] --> B["_read_and_validate_yaml_run_values(yaml_path)"]
    B --> B1["OmegaConf.load(path)"]
    B1 --> B2["Validate envelope: runs list, no unknown fields, no duplicate names"]
    B2 --> B3["Return: dict[run_name → raw YAML values]"]
    B3 --> C{GlobalHydra initialized?}
    C -->|Yes| D["nullcontext()"]
    C -->|No| E["initialize(config_path=None)"]
    D & E --> F["with composition_context"]
    F --> G["For each run: _compose_arena_run_from_yaml_values"]
    G --> G1["Pop environment_values, policy_values from run_values"]
    G1 --> G2["_compose_typed_config_from_yaml_selector(env_values, env_cfg_types)"]
    G1 --> G3["_compose_typed_config_from_yaml_selector(policy_values, policy_cfg_types)"]
    G2 & G3 --> G4["Validate type selector → resolve concrete cfg class"]
    G4 --> G5["ConfigStore.store(schema=cfg_type)\nConfigStore.store(node=defaults+values)"]
    G5 --> G6["compose() → OmegaConf.to_object() → typed cfg instance"]
    G6 --> H["ConfigStore.store(schema=ArenaRunCfg)\nConfigStore.store(run node with remaining_values)"]
    H --> H1["compose() → OmegaConf.to_object() → ArenaRunCfg"]
    H1 --> I["Collect all runs into arena_runs_by_name dict"]
    I --> J["ConfigStore.store(root node: runs by name)"]
    J --> K["compose(root, overrides=overrides) → apply experiment-level overrides"]
    K --> L["OmegaConf.to_object per run → final ArenaExperiment list"]
Loading

Reviews (1): Last reviewed commit: "Use indentless YAML Run sequence" | Re-trigger Greptile

@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. A few nits but looks great!

Compose named YAML runs into typed environment and policy configs with Hydra overrides. Add a Maple-table runtime smoke test while leaving eval_runner and legacy JSON behavior unchanged.

Signed-off-by: Clemens Volk <[email protected]>
Replace the synthetic Maple Table example with a typed YAML equivalent of the existing getting-started JSON experiment. Represent Runs as named sequence items while retaining name-based Hydra overrides.

Signed-off-by: Clemens Volk <[email protected]>
Distinguish Hydra-backed YAML composition from the evaluation module that defines the ArenaExperiment domain type.

Signed-off-by: Clemens Volk <[email protected]>
Document that Experiment composition borrows active Hydra state and add regression coverage preventing it from clearing or replacing that state.

Signed-off-by: Clemens Volk <[email protected]>
Use a stable Arena-specific namespace so repeated Experiment loads replace temporary Hydra schemas instead of accumulating them. Cover repeated composition within a caller-owned Hydra context.

Signed-off-by: Clemens Volk <[email protected]>
@cvolkcvolk
cvolkcvolk force-pushed the cvolk/refactor/hydra-experiment-composition branch from a0b06b0 to 419a2cc Compare July 9, 2026 16:56
@cvolkcvolk
cvolkcvolk changed the base branch from cvolk/refactor/remove-evaluation-job-model to main July 9, 2026 16:57
@cvolkcvolk
cvolkcvolk enabled auto-merge (squash) July 9, 2026 18:01
@cvolkcvolk
cvolkcvolk merged commit 3be9f6a into main Jul 9, 2026
9 of 12 checks passed
cvolkcvolk added a commit that referenced this pull request Jul 12, 2026
## Summary
Connect typed YAML Experiments to eval_runner while preserving legacy
JSON evaluation.

## Detailed description
- Build on #873 by accepting typed YAML arena experiments through the
`--experiment_config` option and forwarding Hydra overrides.
- Compose typed Runs only after AppLauncher starts, avoiding pre-start
runtime registry and pxr imports without changing registry boundaries.
- Preserve legacy JSON behavior and the `--eval_jobs_config` alias until
legacy json files are ported.

---------

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