Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions miles/backends/sglang_utils/arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,13 @@ def validate_args(args):
if args.sglang_dp_size > 1:
assert args.sglang_enable_dp_attention

from miles.utils.environ import enable_experimental_rollout_refactor

if args.sglang_router_policy is None and args.use_session_server and not enable_experimental_rollout_refactor():
args.sglang_router_policy = "manual"
if args.router_assignment_mode == "random":
args.router_assignment_mode = "min_load"

if args.sglang_router_policy:
from miles.utils.environ import enable_experimental_rollout_refactor

Expand Down
4 changes: 2 additions & 2 deletions miles/rollout/sglang_rollout.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ async def generate(args: Namespace, sample: Sample, sampling_params: dict[str, A

# Use session_id for consistent hashing routing if router uses consistent_hashing policy
headers = None
if args.sglang_router_policy == "consistent_hashing" and sample.session_id:
if args.sglang_router_policy in ("consistent_hashing", "manual") and sample.session_id:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The comment on line 195 still specifically mentions the consistent_hashing policy. Since support for the manual policy has been added, please update the comment to reflect this change (e.g., by generalizing it to session-based routing).

headers = {"X-SMG-Routing-Key": sample.session_id}

output = await post(url, payload, headers=headers)
Expand Down Expand Up @@ -314,7 +314,7 @@ async def generate_and_rm_group(
return group

# Generate a unique session_id for each sample in the group (consistent hashing only)
if args.sglang_router_policy == "consistent_hashing":
if args.sglang_router_policy in ("consistent_hashing", "manual"):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The comment on line 316 still states (consistent hashing only). Since the manual policy is now also supported, please update this comment to prevent misleading future readers.

for sample in group:
if sample.session_id is None:
sample.session_id = str(uuid.uuid4())
Expand Down
Loading