Skip to content

[ray] expose get_scheduler_actor_name so callers can look up the schedulers - #34621

Closed
xyuzh wants to merge 2 commits into
sgl-project:mainfrom
xyuzh:xinyu/scheduler-actor-name-helper
Closed

xyuzh wants to merge 2 commits into
sgl-project:mainfrom
xyuzh:xinyu/scheduler-actor-name-helper

Conversation

@xyuzh

@xyuzh xyuzh commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Motivation

RayEngine names each SchedulerActor, but the name format is inlined in _create_scheduler_actor. A process outside the engine that wants handles to those schedulers — e.g. an RL trainer that supplied the placement group and wants to push weights straight into the scheduler actors — has no supported way to address them, and ends up scanning ray.util.list_named_actors() for substring matches.

Modifications

  • Extract the name format into get_scheduler_actor_name(*, rank0_node_ip, dp_rank, pp_rank, tp_rank, port, bundle_idx) and call it from _create_scheduler_actor.
  • Re-export it from sglang.srt.ray.
  • Key the name by the engine's http port instead of _pg{hex}. The placement-group id is only knowable inside RayEngine, so an external caller cannot reproduce it; the port is assigned per host, so (node ip, port) uniquely identifies an engine and keeps engines co-located on one node distinct.

With this, a caller that knows the node ip, ranks, port and bundle indices it handed to RayEngine can rebuild the name and ray.get_actor() directly.

Note this does change the actor names RayEngine produces (_pg{hex}_port{port}). Nothing in-tree reads the names — _create_scheduler_actor was the only place the format appeared.

Checklist

  • Format the code
  • No new dependencies

CI States

Latest PR Test (Base): ❌ Run #31641744701
Latest PR Test (Extra): ❌ Run #31641744995

…dulers

The SchedulerActor name format is inlined in _create_scheduler_actor, so an
external process that wants a handle to the schedulers (for example a trainer
that supplied the placement group and pushes weights into them) can only find
them by scanning ray.util.list_named_actors for substring matches.

Move the format into a get_scheduler_actor_name() helper and re-export it from
sglang.srt.ray. The name is fully determined by the placement group, bundle
index and ranks, all of which such a caller already knows, so it can rebuild
the name and ray.get_actor() directly. Pure refactor: the produced names are
unchanged.
@xyuzh
xyuzh requested a review from Qiaolin-Yu as a code owner August 12, 2026 19:07
…group

Replace the _pg{hex} segment with the engine's http port. The placement-group
id is only knowable inside RayEngine, so a caller that wants to rebuild the
name cannot produce it; the port is assigned per host, which makes
(node ip, port) a unique key for an engine and keeps engines co-located on one
node distinct.

Also matches get_scheduler_actor_name's signature to what such a caller has on
hand: node ip, ranks, port and bundle index.
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.

1 participant