Repository navigation
[6Bi] Simplify task preset traversal and CLI help - #8476
Conversation
|
run-ci |
|
| return isinstance(cfg, self.base_classes) or ( | ||
| self is PresetTarget.PHYSICS and isinstance(cfg, SimulationCfg) and isinstance(cfg.physics, PhysicsCfg) | ||
| ) |
There was a problem hiding this comment.
Environment browser tooling crashes
Removing PresetTarget.all_legacy_aliases() breaks tools/environ_docs.py, which still calls it twice while building _BACKEND_MIRROR_NAMES at import time. The environment-browser update command now raises AttributeError before it can run, and tools/test/test_environ_docs.py fails during test collection.
Update these callers to use the shared alias table, or retain a compatible method.
There was a problem hiding this comment.
Isaac Lab Review Bot
Needs attention: Compatibility and deprecation (1), Implementation (1), Style consistency (1), Test quality (1). Other reviewed categories look good.
- PR description: The body matches the traversal/help diff and line counts, but must disclose the PresetTarget API removal and contributing-guide change; this non-hot-path refactor needs no performance evidence.
- Design and architecture: Architecture looks good.
- Scope and over-engineering: No over-engineering issues.
- API: API changes look good.
- Compatibility and deprecation: Breaking changes: documented PresetTarget alias accessors are removed without deprecation; retain forwarding accessors, targeted warnings, migration guidance, removal guidance, and transition coverage.
- Implementation: Unknown-preset diagnostics emit blank entries for default-only paths, obscuring available choices; filter out paths with no non-default alternatives.
- Style consistency: Help bullet indentation duplicates the selector width and gap as a space literal; derive it from the same named dimensions.
- Test quality: Both changed test files were audited; remove the module-introspection assertion because it enforces class absence rather than CLI behavior already covered by help-output tests.
Significant concerns. Posted 4 inline findings.
Automated review; human maintainers own approval decisions.
| lines.append(f"'{name}' was renamed to '{_LEGACY_PRESET_ALIASES[name]}'; this task declares neither.") | ||
| lines.append("Available presets by config path:") | ||
| lines.extend( | ||
| f" {path}: {', '.join(name for name in fields if name != 'default')}" |
There was a problem hiding this comment.
🟡 Warning · Implementation — Error lists paths without selectable names
A path whose only field is default renders as env.x: with an empty list, unlike the previous message which omitted such paths. Skip paths that contribute no selectable names.
| ) | ||
| description.append(f" {syntax:23} {meaning}" + (". Available:" if variants is not None else "")) | ||
| if variants is not None: | ||
| description.extend(f" - {name}" for name in variants[target]) |
There was a problem hiding this comment.
🟡 Warning · Style Consistency — Bullet indent duplicates column width
The 30-space literal must track the {syntax:23} field plus the prefix and gap on line 122; changing either silently misaligns help output. Derive the indent from the same width value.
| if isinstance(cfg, self.base_classes): | ||
| return True | ||
| return self is PresetTarget.PHYSICS and isinstance(cfg, SimulationCfg) and isinstance(cfg.physics, PhysicsCfg) | ||
|
|
There was a problem hiding this comment.
🟡 Warning · Compatibility — Public alias API removed without deprecation
PresetTarget.all_legacy_aliases() and each member's legacy_aliases were public, documented members; deleting them breaks callers outright. Keep forwarding accessors over the new table with a DeprecationWarning until the announced removal.
| from isaaclab_tasks.utils.preset_cli import setup_preset_cli | ||
|
|
||
| # Keep parsing and formatting in argparse, without private helper classes in the CLI module. | ||
| assert not any( |
There was a problem hiding this comment.
🟡 Warning · Test Quality — Assertion checks module structure
This asserts the module defines no classes, so it fails under any behavior-preserving refactor while catching no CLI regression. Remove it; the help-output assertions already own this contract.
|
run-ci |
|
run-ci |
799aa92 to
80aa432
Compare
| level = 1 | ||
| frame = sys._getframe(1) | ||
| while frame is not None and frame.f_globals.get("__name__", "").startswith(__package__): | ||
| while frame is not None and frame.f_globals.get("__name__", "").startswith("isaaclab_tasks.utils"): |
There was a problem hiding this comment.
this is a very interesting hack, is there a better way to write it?
…uncher Develop moved under this branch: isaac-sim#8476 folded preset_cli and preset_target into isaaclab_tasks.utils.hydra, list_envs grew a public registry walk, and the launcher validators the tools/ module imported now take a dict, so every resolved combination was being dropped as an "API failure". Resolution now lives beside enumerate_task_presets as resolve_task_runs, which passes tokens through resolve_task_config(overrides=) instead of swapping sys.argv, and checks each combination with a new public isaaclab.app.validate_launch -- the scan and validation launch_simulation starts with, which now calls it too. Only ValueError counts as a rejection; any other error propagates. Across the registry that is 140 tasks and 1032 distinct runs in 133s, with no other exception raised and every default run accepted. ``isaaclab list_envs --resolve`` is the in-tree consumer. The tools/ module, its copies of the training-task filter and RL-library order, and its stubbed tests are removed; environ_docs is left as develop has it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Description
Simplify task preset traversal and replace the custom CLI argument scanner, help builder, and formatter with argparse. This includes observable changes to help, error output, and configuration traversal; the examples below show those changes.
Preset parsing, categories, and traversal now live together in
isaaclab_tasks.utils.hydra;preset_cli.pyandpreset_target.pyare removed. Preset handling stays inisaaclab_tasks. Runtime launch and visualizer selection changes are in #8126; the independent SDG fix is #8475. 22 files; +354 / −894 lines (540 fewer overall).Before and after
Unknown preset: same rejection, different error output
Before, the error grouped names by their affected paths:
After, it lists each configuration path and its choices directly, in declaration order:
The command still fails before simulation launch. Typed-selector errors are also shorter. For example:
Both revisions reject
physics=rgbbecause RGB is not a physics preset. After this change, the error retainsTyped preset selector(s) physics=rgb did not match any preset of that type for this task.and removes the following explanation/suggested fixes.Help invoked with an explicit argument list now uses that list
uv run python -c 'from isaaclab.cli import train; train(["--task", "Isaac-Cartpole-Direct", "--rl_library", "rsl_rl", "--help"])'sys.argvfor the task, so it printedPass --task=X along with --help to see preset variants available for that task, despite the task being supplied totrain().isaacsim_physx,newton_kamino,newton_mjwarp,ovphysx, andphysxunderphysics=NAME.The ordinary
uv run isaaclab train --task Isaac-Cartpole-Direct --rl_library rsl_rl --helpcommand lists those choices in both revisions. Help formatting now uses argparse'sRawDescriptionHelpFormatter.Python configuration traversal changes
These affect callers constructing configurations in Python:
a: preset inside a tuplePresetCfg2b: preset inside a namespacePresetCfg2c: discovery on an arbitrary custom object["mode"][]d: paths inside a dictionary-valued alternative[""]— the nested key was lost["", "nested"]Custom-configuration compatibility: traversal now uses config/dataclass instance fields, namespaces, mappings, lists, and tuples. It no longer inspects arbitrary object properties or class attributes with
dir()/getattr(). Callers relying on that discovery must use@configclassfields or one of the supported containers.Direct imports
Replace
isaaclab_tasks.utils.preset_cliandisaaclab_tasks.utils.preset_targetimports withisaaclab_tasks.utils.hydra. The package-levelfrom isaaclab_tasks.utils import setup_preset_cliremains unchanged. This consolidation preserves selection and help behavior and fixes the environment documentation tool's stale alias lookup.Validation
e21e2515) and the pre-rebase implementation (d00bbe09d).3c02cf760, 159 focused tests passed across preset composition/help, Franka presets, checkpoint tooling, task discovery, and environment documentation. The existing help test also guards against reintroducing the two removed modules.test_visualizer_golden[newton-cartpole-kit-tiled], passed locally on GPU0 in 28 seconds. The complete Newton golden-image file finished with 9 passes and 3 image mismatches; all 3 mismatches also reproduced on unmodified develop with effectively identical image scores. No skips, thresholds, or retries were changed.80aa4326b; the earlier native CI crash has not been reproduced locally or established as fixed.Type of change
Release backport
developChecklist