8000 [RLlib] Upgrade RLlink protocol for external env/simulator training. by sven1977 · Pull Request #53550 · ray-project/ray · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[RLlib] Upgrade RLlink protocol for external env/simulator training. #53550

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

sven1977
Copy link
Contributor
@sven1977 sven1977 commented Jun 4, 2025

Upgrade RLlink protocol for external env/simulator training.

Why are these changes needed?

Related issue number

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
    • I've added any new APIs to the API Reference. For example, if I added a
      method in Tune, I've added it in doc/source/tune/api/ under the
      corresponding .rst file.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

Signed-off-by: sven1977 <svenmika1977@gmail.com>
@Copilot Copilot AI review requested due to automatic review settings June 4, 2025 12:12
@sven1977 sven1977 requested a review from a team as a code owner June 4, 2025 12:12
Copy link
Contributor
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR upgrades the RLlink protocol for external environment/simulator training by deprecating legacy example scripts and refactoring internal APIs to use the new rllink protocol and associated message‐packing via msgpack.

  • Removal of outdated Unity3D and CartPole example scripts.
  • Refactoring of annotations (e.g., replacing @publicapi with @OldAPIStack) and protocol messaging (using new RLlink API in rllink.py).
  • Introduction of new modules (rllink.py and rllib_gateway.py) and updates in algorithm_config.py.

Reviewed Changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated no comments.

Show a summary per file
File Description
rllib/examples/envs/external_envs/*.py Removed outdated example scripts for external env training.
rllib/env/wrappers/unity3d_env.py Updated API annotation and trimmed outdated docstrings.
rllib/env/utils/external_env_protocol.py Redirected RLlink import to new rllink implementation.
rllib/env/tcp_client_inference_env_runner.py Updated message functions to use new RLlink API.
rllib/env/policy_server_input.py, rllib/env/policy_client.py Removed legacy docstrings and updated annotations.
rllib/env/external/rllink.py, rllib/env/external/rllib_gateway.py New modules for upgraded protocol and external gateway.
rllib/algorithms/algorithm_config.py Minor comment fix and additional handling for spaces.
Comments suppressed due to low confidence (1)

rllib/algorithms/algorithm_config.py:327

  • Typo in comment: 'reaplce' should be corrected to 'replace'.
# TODO (sven): Once new ormsgpack system in place, reaplce the string

Signed-off-by: sven1977 <svenmika1977@gmail.com>
Copy link
Collaborator
@simonsays1980 simonsays1980 left a comment

Choose a reason for hiding this comment

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

LGTM. Some small nits. Thanks for the work @sven1977 !

if isinstance(env, gym.vector.VectorEnv):
rl_module_spec.observation_space = env.single_observation_space
rl_module_spec.action_space = env.single_action_space
if rl_module_spec.observation_space is None:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Dumb question: Can't we reuse the self.obs_space, self.action_space here?

self._prev_action = None
self._prev_extra_model_outputs = None

def _connecto_to_server_thread_func():
Copy link
Collaborator

Choose a reason for hiding this comment

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

_connecto_... -> _connect_to_...? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

great catch. Fixed

next_observation: The current observation, from which the action should be
computed. Note that first, `observation`, the previously returned
action, `prev_reward`, and `terminated/truncated` are logged with the running
episdode through `Episode.add_env_step()`, then the env-to-module
Copy link
Collaborator

Choose a reason for hiding this comment

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

"epsidode" -> "episode"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@sven1977 sven1977 enabled auto-merge (squash) June 5, 2025 13:30
@github-actions github-actions bot added the go add ONLY when ready to merge, run all tests label Jun 5, 2025
Signed-off-by: sven1977 <svenmika1977@gmail.com>
@github-actions github-actions bot disabled auto-merge June 5, 2025 13:37
sven1977 added 7 commits June 5, 2025 16:24
Signed-off-by: sven1977 <svenmika1977@gmail.com>
Signed-off-by: sven1977 <svenmika1977@gmail.com>
Signed-off-by: sven1977 <svenmika1977@gmail.com>
Signed-off-by: sven1977 <svenmika1977@gmail.com>
Signed-off-by: sven1977 <svenmika1977@gmail.com>
Signed-off-by: sven1977 <svenmika1977@gmail.com>
@sven1977 sven1977 requested a review from a team as a code owner June 13, 2025 09:04
Signed-off-by: sven1977 <svenmika1977@gmail.com>
@sven1977 sven1977 enabled auto-merge (squash) June 13, 2025 11:16
sven1977 added 2 commits June 17, 2025 14:49
Signed-off-by: sven1977 <svenmika1977@gmail.com>
@github-actions github-actions bot disabled auto-merge June 17, 2025 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go add ONLY when ready to merge, run all tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0