config: ServerArgs holds the raw input (#36255)
This commit is contained in:
@@ -87,22 +87,25 @@ def launch_server_process(
|
||||
server_args: ServerArgs, worker_port: int, dp_id: int
|
||||
) -> mp.Process:
|
||||
"""Launch a single server process with the given args and port."""
|
||||
# This binding is installed against a released sglang, so it cannot call
|
||||
# into helpers newer than that wheel. Copy first, then write through the
|
||||
# sanctioned channel if the record is resolved (a resolved record refuses
|
||||
# plain assignment), else assign.
|
||||
worker_args = copy.deepcopy(server_args)
|
||||
changes = {
|
||||
"port": worker_port,
|
||||
"base_gpu_id": dp_id * server_args.tp_size,
|
||||
"dp_size": 1,
|
||||
}
|
||||
late = getattr(worker_args, "_late_resolution", None)
|
||||
if late is not None and getattr(worker_args, "_declarations_materialized", False):
|
||||
late("sglang_router.launch_server_process", **changes)
|
||||
# Three channels, newest first. A wheel that has the read-only record but not
|
||||
# `replace_resolved` still has `_late_resolution`, and plain assignment there
|
||||
# raises; only a wheel with neither accepts `setattr`.
|
||||
replace_resolved = getattr(server_args, "replace_resolved", None)
|
||||
if replace_resolved is not None:
|
||||
worker_args = replace_resolved("sglang_router.launch_server_process", **changes)
|
||||
else:
|
||||
for field, value in changes.items():
|
||||
setattr(worker_args, field, value)
|
||||
worker_args = copy.deepcopy(server_args)
|
||||
late = getattr(worker_args, "_late_resolution", None)
|
||||
if late is not None:
|
||||
late("sglang_router.launch_server_process", **changes)
|
||||
else:
|
||||
for field, value in changes.items():
|
||||
setattr(worker_args, field, value)
|
||||
server_args = worker_args
|
||||
|
||||
proc = mp.Process(target=run_server, args=(server_args, dp_id))
|
||||
@@ -188,7 +191,11 @@ def main():
|
||||
server_args.resolve_once()
|
||||
router_args = RouterArgs.from_cli_args(args, use_router_prefix=True)
|
||||
|
||||
# Find available ports for workers
|
||||
# Find available ports for workers. The count is the operator's requested
|
||||
# replica count, which is the raw field on purpose: `--dwdp-size` makes
|
||||
# resolution declare a `dp_size` that describes one multi-rank server's
|
||||
# internal topology, and spawning that many single-rank children would ask
|
||||
# for dp_size^2 GPUs.
|
||||
worker_ports = find_available_ports(
|
||||
args.router_dp_worker_base_port, server_args.dp_size
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user