[RLlib] Add custom_resources_for_main_process to AlgorithmConfig#62475
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces the custom_resources_for_main_process configuration option to RLlib, allowing for custom Ray resource allocation for the main algorithm process. The changes span AlgorithmConfig, resource utility functions, and include new unit tests. Review feedback recommends defaulting the new parameter to an empty dictionary to avoid potential TypeError during unpacking, clarifying the docstring to specify the target process, and adjusting the order of dictionary merging in _get_main_process_bundle to prevent custom resources from overwriting mandatory CPU and GPU keys.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Reviewed by Cursor Bugbot for commit eb7a7b613dc6a4fc03b73a2ebea6bd5478d42cde. Configure here.
Allow users to specify custom Ray resources for the main Algorithm
actor's placement bundle via `config.resources(custom_resources_for_main_process={"on_demand": 0.001})`.
This enables pinning the Algorithm actor to specific node types
(e.g., on-demand nodes) when `num_learners > 0` and the main process
bundle would otherwise only request `{"CPU": 1, "GPU": 0}`.
The custom resources are unpacked into the main process bundle in
both code paths of `_get_main_process_bundle()` (num_learners == 0
and num_learners > 0).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Signed-off-by: Artur Niederfahrenhorst <attaismyname@googlemail.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Artur Niederfahrenhorst <artur@anyscale.com>
Signed-off-by: Artur Niederfahrenhorst <artur@anyscale.com>
18106eb to
735624e
Compare
…-project#62475) Allow users to specify custom Ray resources for the main Algorithm actor's placement bundle via `config.resources(custom_resources_for_main_process={"my_custom_resources": 1})`. --------- Signed-off-by: Artur Niederfahrenhorst <attaismyname@googlemail.com> Signed-off-by: Artur Niederfahrenhorst <artur@anyscale.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

Allow users to specify custom Ray resources for the main Algorithm actor's placement bundle via
config.resources(custom_resources_for_main_process={"my_custom_resources": 1}).