Repository navigation
Fixes rl_games workflow's log_root_path to be the absolute path - #3531
Conversation
|
Hi @ooctipus, would love to get your opinion before merging on the line: |
|
sorry for the late response, yes I believe this is correct! |
There was a problem hiding this comment.
Greptile Overview
Greptile Summary
This PR fixes a bug where log_root_path remained a relative path when PBT (Population-Based Training) is not used, which broke functionality in Ray and potentially other systems that expect absolute paths.
Key Changes
- Restructured the conditional logic to ensure
os.path.abspath()is called when PBT is not enabled or when PBT directory is "." - Successfully addresses the main issue reported in #3530
Issues Found
- The author's concern about PBT path handling is valid: when
agent_cfg["pbt"]["directory"]is set to a relative path or empty string (the default inPbtCfg), the resultinglog_root_pathwill still be relative - Added debug print statement at line 159 that may need removal
Confidence Score: 4/5
- This PR is safe to merge with one logical issue that should be addressed
- The PR successfully fixes the primary bug (non-absolute path when PBT is disabled), but has an edge case where PBT with relative/empty directory still produces relative paths. The fix is simple and the author already identified this concern in the PR description.
- Pay attention to
scripts/reinforcement_learning/rl_games/train.pylines 141-144 for the PBT path handling edge case
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| scripts/reinforcement_learning/rl_games/train.py | 4/5 | Fixes log_root_path to be absolute when PBT is not used, but PBT path handling still has edge cases with relative or empty directory values |
Sequence Diagram
sequenceDiagram
participant Main as main()
participant PathLogic as Path Logic
participant Config as agent_cfg
participant FileSystem as File System
Main->>Config: Read config_name
Main->>PathLogic: Create log_root_path = "logs/rl_games/{config_name}"
alt PBT enabled AND directory != "."
PathLogic->>Config: Get agent_cfg["pbt"]["directory"]
PathLogic->>PathLogic: os.path.join(pbt_dir, log_root_path)
Note over PathLogic: May be relative if pbt_dir is relative/empty!
else No PBT OR directory == "."
PathLogic->>PathLogic: os.path.abspath(log_root_path)
Note over PathLogic: Now absolute (fixes the bug)
end
PathLogic->>Main: Return log_root_path
Main->>FileSystem: Create directories with log_root_path
Main->>FileSystem: dump_yaml() to log_root_path
Main->>Config: Set train_dir = log_root_path
1 file reviewed, 2 comments
There was a problem hiding this comment.
Greptile Overview
Greptile Summary
Fixes the missing else clause that caused log_root_path to remain relative when PBT is not used, restoring the absolute path behavior that Ray and other integrations depend on.
Key changes:
- Restructured the PBT directory check to use a single if-else statement
- Added
os.path.abspath()call in the else branch for non-PBT scenarios - Fixed the immediate issue reported in #3530
Remaining issues:
- When PBT is enabled with a relative or empty
directoryvalue (default is""),log_root_pathwill still be relative, which could cause the same issue - The existing comment correctly identifies this concern and suggests wrapping the PBT case with
os.path.abspath()as well - Added a debug print statement on line 159 that should be removed
Confidence Score: 3/5
- Safe to merge but incomplete - fixes the immediate issue while leaving PBT edge case unresolved
- The PR successfully addresses the reported bug for non-PBT scenarios, but the PBT path handling still has the same relative path issue when
agent_cfg["pbt"]["directory"]is relative or empty (default is""). The existing reviewer comment correctly identifies this and provides a solution. Additionally, a debug print statement was added that should be removed. - scripts/reinforcement_learning/rl_games/train.py requires attention to address the PBT relative path issue and remove debug print
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| scripts/reinforcement_learning/rl_games/train.py | 2/5 | Fixes missing else clause for absolute path conversion, but PBT path handling still has issues with relative paths |
Sequence Diagram
sequenceDiagram
participant Main as main()
participant Config as agent_cfg
participant FS as File System
participant RLGames as RL-Games Runner
Main->>Config: Get config_name
Main->>Main: Create relative path<br/>"logs/rl_games/{config_name}"
alt PBT enabled AND directory != "."
Main->>Config: Get pbt["directory"]
Main->>Main: os.path.join(pbt_dir, log_root_path)<br/>(may still be relative!)
else PBT disabled OR directory == "."
Main->>Main: os.path.abspath(log_root_path)<br/>(now absolute ✓)
end
Main->>Config: Set train_dir = log_root_path
Main->>FS: Create directories
Main->>FS: dump_yaml(env.yaml)
Main->>FS: dump_yaml(agent.yaml)
Main->>RLGames: Initialize runner with log_root_path
Note over Main,RLGames: Ray and other integrations<br/>expect absolute paths
1 file reviewed, 1 comment
…saac-sim#3531) # Description Due to previous changes, the `rl_games` workflow's `log_root_path` is no longer the absolute path if the pbt option is not used, causing further issues. This PR fixes this by making it an absolute path again. Fixes isaac-sim#3530 ## Type of change - Bug fix (non-breaking change which fixes an issue) ## Screenshots Before: https://github.com/isaac-sim/IsaacLab/blob/3a2ec7c823be23c2ad9790788455cfb990c86b2b/scripts/reinforcement_learning/rl_games/train.py#L129-L135 After: ``` log_root_path = os.path.join("logs", "rl_games", config_name) if "pbt" in agent_cfg and agent_cfg["pbt"]["directory"] != ".": log_root_path = os.path.join(agent_cfg["pbt"]["directory"], log_root_path) else: log_root_path = os.path.abspath(log_root_path) ``` ## Note While this fixes the path to be absolute when pbt is not used, I am not sure if `log_root_path = os.path.join(agent_cfg["pbt"]["directory"], log_root_path)` is correct or absolute, as I do not use pbt. Should it not be something like the following? `log_root_path = os.path.abspath(os.path.join(log_root_path, agent_cfg["pbt"]["directory"])) ` I would appreciate any feedback on this. ## Checklist - [x] I have read and understood the [contribution guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html) - [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with `./isaaclab.sh --format` - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] I have updated the changelog and the corresponding version in the extension's `config/extension.toml` file - [x] I have added my name to the `CONTRIBUTORS.md` or my name already exists there --------- Co-authored-by: sbtc-sipbb <[email protected]> Co-authored-by: garylvov <[email protected]> Co-authored-by: garylvov <[email protected]>
…saac-sim#3531) # Description Due to previous changes, the `rl_games` workflow's `log_root_path` is no longer the absolute path if the pbt option is not used, causing further issues. This PR fixes this by making it an absolute path again. Fixes isaac-sim#3530 ## Type of change - Bug fix (non-breaking change which fixes an issue) ## Screenshots Before: https://github.com/isaac-sim/IsaacLab/blob/3a0db9d761982dc65417e6c6d0714cec61ceadb3/scripts/reinforcement_learning/rl_games/train.py#L129-L135 After: ``` log_root_path = os.path.join("logs", "rl_games", config_name) if "pbt" in agent_cfg and agent_cfg["pbt"]["directory"] != ".": log_root_path = os.path.join(agent_cfg["pbt"]["directory"], log_root_path) else: log_root_path = os.path.abspath(log_root_path) ``` ## Note While this fixes the path to be absolute when pbt is not used, I am not sure if `log_root_path = os.path.join(agent_cfg["pbt"]["directory"], log_root_path)` is correct or absolute, as I do not use pbt. Should it not be something like the following? `log_root_path = os.path.abspath(os.path.join(log_root_path, agent_cfg["pbt"]["directory"])) ` I would appreciate any feedback on this. ## Checklist - [x] I have read and understood the [contribution guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html) - [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with `./isaaclab.sh --format` - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] I have updated the changelog and the corresponding version in the extension's `config/extension.toml` file - [x] I have added my name to the `CONTRIBUTORS.md` or my name already exists there --------- Co-authored-by: sbtc-sipbb <[email protected]> Co-authored-by: garylvov <[email protected]> Co-authored-by: garylvov <[email protected]>
…saac-sim#3531) # Description Due to previous changes, the `rl_games` workflow's `log_root_path` is no longer the absolute path if the pbt option is not used, causing further issues. This PR fixes this by making it an absolute path again. Fixes isaac-sim#3530 ## Type of change - Bug fix (non-breaking change which fixes an issue) ## Screenshots Before: https://github.com/isaac-sim/IsaacLab/blob/3a2ec7c823be23c2ad9790788455cfb990c86b2b/scripts/reinforcement_learning/rl_games/train.py#L129-L135 After: ``` log_root_path = os.path.join("logs", "rl_games", config_name) if "pbt" in agent_cfg and agent_cfg["pbt"]["directory"] != ".": log_root_path = os.path.join(agent_cfg["pbt"]["directory"], log_root_path) else: log_root_path = os.path.abspath(log_root_path) ``` ## Note While this fixes the path to be absolute when pbt is not used, I am not sure if `log_root_path = os.path.join(agent_cfg["pbt"]["directory"], log_root_path)` is correct or absolute, as I do not use pbt. Should it not be something like the following? `log_root_path = os.path.abspath(os.path.join(log_root_path, agent_cfg["pbt"]["directory"])) ` I would appreciate any feedback on this. ## Checklist - [x] I have read and understood the [contribution guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html) - [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with `./isaaclab.sh --format` - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] I have updated the changelog and the corresponding version in the extension's `config/extension.toml` file - [x] I have added my name to the `CONTRIBUTORS.md` or my name already exists there --------- Co-authored-by: sbtc-sipbb <[email protected]> Co-authored-by: garylvov <[email protected]> Co-authored-by: garylvov <[email protected]>
Description
Due to previous changes, the
rl_gamesworkflow'slog_root_pathis no longer the absolute path if the pbt option is not used, causing further issues. This PR fixes this by making it an absolute path again.Fixes #3530
Type of change
Screenshots
Before:
IsaacLab/scripts/reinforcement_learning/rl_games/train.py
Lines 129 to 135 in 3a0db9d
After:
Note
While this fixes the path to be absolute when pbt is not used, I am not sure if
log_root_path = os.path.join(agent_cfg["pbt"]["directory"], log_root_path)is correct or absolute, as I do not use pbt. Should it not be something like the following?
log_root_path = os.path.abspath(os.path.join(log_root_path, agent_cfg["pbt"]["directory"]))I would appreciate any feedback on this.
Checklist
pre-commitchecks with./isaaclab.sh --formatconfig/extension.tomlfileCONTRIBUTORS.mdor my name already exists there