@@ -145,10 +145,11 @@ def add_cli_args(
145
145
)
146
146
parser .add_argument (
147
147
f"--{ prefix } prefill" ,
148
- nargs = 2 ,
148
+ nargs = "+" ,
149
149
action = "append" ,
150
- metavar = ("URL" , "BOOTSTRAP_PORT" ),
151
- help = "Prefill server URL and bootstrap port. Can be specified multiple times. BOOTSTRAP_PORT can be 'none' for no bootstrap port." ,
150
+ help = "Prefill server URL and optional bootstrap port. Can be specified multiple times. "
151
+ "Format: --prefill URL [BOOTSTRAP_PORT]. "
152
+ "BOOTSTRAP_PORT can be a port number, 'none', or omitted (defaults to none)." ,
152
153
)
153
154
parser .add_argument (
154
155
f"--{ prefix } decode" ,
@@ -389,24 +390,36 @@ def _parse_selector(selector_list):
389
390
def _parse_prefill_urls (prefill_list ):
390
391
"""Parse prefill URLs from --prefill arguments.
391
392
392
- Format: --prefill URL BOOTSTRAP_PORT
393
- Example: --prefill http://prefill1:8080 9000 --prefill http://prefill2:8080 none
393
+ Format: --prefill URL [BOOTSTRAP_PORT]
394
+ Example:
395
+ --prefill http://prefill1:8080 9000 # With bootstrap port
396
+ --prefill http://prefill2:8080 none # Explicitly no bootstrap port
397
+ --prefill http://prefill3:8080 # Defaults to no bootstrap port
394
398
"""
395
399
if not prefill_list :
396
400
return []
397
401
398
402
prefill_urls = []
399
- for url , bootstrap_port_str in prefill_list :
400
- # Handle 'none' as None
401
- if bootstrap_port_str .lower () == "none" :
402
- bootstrap_port = None
403
+ for prefill_args in prefill_list :
404
+
405
+ url = prefill_args [0 ]
406
+
407
+ # Handle optional bootstrap port
408
+ if len (prefill_args ) >= 2 :
409
+ bootstrap_port_str = prefill_args [1 ]
410
+ # Handle 'none' as None
411
+ if bootstrap_port_str .lower () == "none" :
412
+ bootstrap_port = None
413
+ else :
414
+ try :
415
+ bootstrap_port = int (bootstrap_port_str )
416
+ except ValueError :
417
+ raise ValueError (
418
+ f"Invalid bootstrap port: { bootstrap_port_str } . Must be a number or 'none'"
419
+ )
403
420
else :
404
- try :
405
- bootstrap_port = int (bootstrap_port_str )
406
- except ValueError :
407
- raise ValueError (
408
- f"Invalid bootstrap port: { bootstrap_port_str } . Must be a number or 'none'"
409
- )
421
+ # No bootstrap port specified, default to None
422
+ bootstrap_port = None
410
423
411
424
prefill_urls .append ((url , bootstrap_port ))
412
425
@@ -578,13 +591,20 @@ def parse_router_args(args: List[str]) -> RouterArgs:
578
591
579
592
# PD disaggregated mode with same policy for both
580
593
python -m sglang_router.launch_router --pd-disaggregation \\
581
- --prefill http://prefill1:8000 9000 --prefill http://prefill2:8000 none \\
594
+ --prefill http://prefill1:8000 9000 --prefill http://prefill2:8000 \\
582
595
--decode http://decode1:8001 --decode http://decode2:8001 \\
583
596
--policy cache_aware
584
597
598
+ # PD mode with optional bootstrap ports
599
+ python -m sglang_router.launch_router --pd-disaggregation \\
600
+ --prefill http://prefill1:8000 9000 \\ # With bootstrap port
601
+ --prefill http://prefill2:8000 none \\ # Explicitly no bootstrap port
602
+ --prefill http://prefill3:8000 \\ # Defaults to no bootstrap port
603
+ --decode http://decode1:8001 --decode http://decode2:8001
604
+
585
605
# PD mode with different policies for prefill and decode
586
606
python -m sglang_router.launch_router --pd-disaggregation \\
587
- --prefill http://prefill1:8000 9000 --prefill http://prefill2:8000 none \\
607
+ --prefill http://prefill1:8000 --prefill http://prefill2:8000 \\
588
608
--decode http://decode1:8001 --decode http://decode2:8001 \\
589
609
--prefill-policy cache_aware --decode-policy power_of_two
590
610
0 commit comments