Skip to content

Commit a77558d

Browse files
authored
feat: allow dynamic port in scripts in preparation for parallel testing (part 1) (#4546)
Signed-off-by: Keiven Chang <[email protected]>
1 parent 0a8b917 commit a77558d

40 files changed

+98
-63
lines changed

examples/backends/sglang/launch/agg.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,13 @@ if [ "$ENABLE_OTEL" = true ]; then
4444
fi
4545

4646
# run ingress
47+
# dynamo.frontend accepts either --http-port flag or DYN_HTTP_PORT env var (defaults to 8000)
4748
OTEL_SERVICE_NAME=dynamo-frontend \
48-
python3 -m dynamo.frontend --http-port=8000 &
49+
python3 -m dynamo.frontend &
4950
DYNAMO_PID=$!
5051

51-
# run worker
52-
OTEL_SERVICE_NAME=dynamo-worker DYN_SYSTEM_PORT=8081 \
52+
# run worker with metrics enabled
53+
DYN_SYSTEM_PORT=${DYN_SYSTEM_PORT:-8081} \
5354
python3 -m dynamo.sglang \
5455
--model-path Qwen/Qwen3-0.6B \
5556
--served-model-name Qwen/Qwen3-0.6B \

examples/backends/sglang/launch/agg_embed.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,13 @@ if [ "$ENABLE_OTEL" = true ]; then
4444
fi
4545

4646
# run ingress
47+
# dynamo.frontend accepts either --http-port flag or DYN_HTTP_PORT env var (defaults to 8000)
4748
OTEL_SERVICE_NAME=dynamo-frontend \
48-
python3 -m dynamo.frontend --http-port=8000 &
49+
python3 -m dynamo.frontend &
4950
DYNAMO_PID=$!
5051

5152
# run worker
52-
OTEL_SERVICE_NAME=dynamo-worker-embedding DYN_SYSTEM_PORT=8081 \
53+
OTEL_SERVICE_NAME=dynamo-worker-embedding DYN_SYSTEM_PORT=${DYN_SYSTEM_PORT:-8081} \
5354
python3 -m dynamo.sglang \
5455
--embedding-worker \
5556
--model-path Qwen/Qwen3-Embedding-4B \

examples/backends/sglang/launch/agg_router.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,13 @@ if [ "$ENABLE_OTEL" = true ]; then
4444
fi
4545

4646
# run ingress
47+
# dynamo.frontend accepts either --http-port flag or DYN_HTTP_PORT env var (defaults to 8000)
4748
OTEL_SERVICE_NAME=dynamo-frontend \
48-
python3 -m dynamo.frontend --router-mode kv --http-port=8000 &
49+
python3 -m dynamo.frontend --router-mode kv &
4950
DYNAMO_PID=$!
5051

5152
# run worker
52-
OTEL_SERVICE_NAME=dynamo-worker-1 DYN_SYSTEM_PORT=8081 \
53+
OTEL_SERVICE_NAME=dynamo-worker-1 DYN_SYSTEM_PORT=${DYN_SYSTEM_PORT_WORKER1:-8081} \
5354
python3 -m dynamo.sglang \
5455
--model-path Qwen/Qwen3-0.6B \
5556
--served-model-name Qwen/Qwen3-0.6B \
@@ -60,7 +61,7 @@ python3 -m dynamo.sglang \
6061
--enable-metrics &
6162
WORKER_PID=$!
6263

63-
OTEL_SERVICE_NAME=dynamo-worker-2 DYN_SYSTEM_PORT=8082 \
64+
OTEL_SERVICE_NAME=dynamo-worker-2 DYN_SYSTEM_PORT=${DYN_SYSTEM_PORT_WORKER2:-8082} \
6465
CUDA_VISIBLE_DEVICES=1 python3 -m dynamo.sglang \
6566
--model-path Qwen/Qwen3-0.6B \
6667
--served-model-name Qwen/Qwen3-0.6B \

examples/backends/sglang/launch/disagg.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,13 @@ if [ "$ENABLE_OTEL" = true ]; then
4444
fi
4545

4646
# run ingress
47+
# dynamo.frontend accepts either --http-port flag or DYN_HTTP_PORT env var (defaults to 8000)
4748
OTEL_SERVICE_NAME=dynamo-frontend \
48-
python3 -m dynamo.frontend --http-port=8000 &
49+
python3 -m dynamo.frontend &
4950
DYNAMO_PID=$!
5051

5152
# run prefill worker
52-
OTEL_SERVICE_NAME=dynamo-worker-prefill DYN_SYSTEM_PORT=8081 \
53+
OTEL_SERVICE_NAME=dynamo-worker-prefill DYN_SYSTEM_PORT=${DYN_SYSTEM_PORT_PREFILL:-8081} \
5354
python3 -m dynamo.sglang \
5455
--model-path Qwen/Qwen3-0.6B \
5556
--served-model-name Qwen/Qwen3-0.6B \
@@ -64,7 +65,7 @@ python3 -m dynamo.sglang \
6465
PREFILL_PID=$!
6566

6667
# run decode worker
67-
OTEL_SERVICE_NAME=dynamo-worker-decode DYN_SYSTEM_PORT=8082 \
68+
OTEL_SERVICE_NAME=dynamo-worker-decode DYN_SYSTEM_PORT=${DYN_SYSTEM_PORT_DECODE:-8082} \
6869
CUDA_VISIBLE_DEVICES=1 python3 -m dynamo.sglang \
6970
--model-path Qwen/Qwen3-0.6B \
7071
--served-model-name Qwen/Qwen3-0.6B \

examples/backends/sglang/launch/disagg_router.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,16 @@ if [ "$ENABLE_OTEL" = true ]; then
4545
fi
4646

4747
# run ingress
48+
# dynamo.frontend accepts either --http-port flag or DYN_HTTP_PORT env var (defaults to 8000)
4849
OTEL_SERVICE_NAME=dynamo-frontend \
4950
python3 -m dynamo.frontend \
50-
--http-port=8000 \
5151
--router-mode kv \
5252
--kv-overlap-score-weight 0 \
5353
--router-reset-states &
5454
DYNAMO_PID=$!
5555

5656
# run prefill router
57-
OTEL_SERVICE_NAME=dynamo-router-prefill DYN_SYSTEM_PORT=8081 \
57+
OTEL_SERVICE_NAME=dynamo-router-prefill DYN_SYSTEM_PORT=${DYN_SYSTEM_PORT_PREFILL_ROUTER:-8081} \
5858
python3 -m dynamo.router \
5959
--endpoint dynamo.prefill.generate \
6060
--block-size 64 \
@@ -63,7 +63,7 @@ python3 -m dynamo.router \
6363
PREFILL_ROUTER_PID=$!
6464

6565
# run prefill worker
66-
OTEL_SERVICE_NAME=dynamo-worker-prefill-1 DYN_SYSTEM_PORT=8082 \
66+
OTEL_SERVICE_NAME=dynamo-worker-prefill-1 DYN_SYSTEM_PORT=${DYN_SYSTEM_PORT_PREFILL_WORKER1:-8082} \
6767
python3 -m dynamo.sglang \
6868
--model-path deepseek-ai/DeepSeek-R1-Distill-Llama-8B \
6969
--served-model-name deepseek-ai/DeepSeek-R1-Distill-Llama-8B \
@@ -78,7 +78,7 @@ python3 -m dynamo.sglang \
7878
PREFILL_PID=$!
7979

8080
# run prefill worker
81-
OTEL_SERVICE_NAME=dynamo-worker-prefill-2 DYN_SYSTEM_PORT=8083 \
81+
OTEL_SERVICE_NAME=dynamo-worker-prefill-2 DYN_SYSTEM_PORT=${DYN_SYSTEM_PORT_PREFILL_WORKER2:-8083} \
8282
CUDA_VISIBLE_DEVICES=1 python3 -m dynamo.sglang \
8383
--model-path deepseek-ai/DeepSeek-R1-Distill-Llama-8B \
8484
--served-model-name deepseek-ai/DeepSeek-R1-Distill-Llama-8B \
@@ -93,7 +93,7 @@ CUDA_VISIBLE_DEVICES=1 python3 -m dynamo.sglang \
9393
PREFILL_PID=$!
9494

9595
# run decode worker
96-
OTEL_SERVICE_NAME=dynamo-worker-decode-1 DYN_SYSTEM_PORT=8084 \
96+
OTEL_SERVICE_NAME=dynamo-worker-decode-1 DYN_SYSTEM_PORT=${DYN_SYSTEM_PORT_DECODE_WORKER1:-8084} \
9797
CUDA_VISIBLE_DEVICES=3 python3 -m dynamo.sglang \
9898
--model-path deepseek-ai/DeepSeek-R1-Distill-Llama-8B \
9999
--served-model-name deepseek-ai/DeepSeek-R1-Distill-Llama-8B \
@@ -108,7 +108,7 @@ CUDA_VISIBLE_DEVICES=3 python3 -m dynamo.sglang \
108108
PREFILL_PID=$!
109109

110110
# run decode worker
111-
OTEL_SERVICE_NAME=dynamo-worker-decode-2 DYN_SYSTEM_PORT=8085 \
111+
OTEL_SERVICE_NAME=dynamo-worker-decode-2 DYN_SYSTEM_PORT=${DYN_SYSTEM_PORT_DECODE_WORKER2:-8085} \
112112
CUDA_VISIBLE_DEVICES=2 python3 -m dynamo.sglang \
113113
--model-path deepseek-ai/DeepSeek-R1-Distill-Llama-8B \
114114
--served-model-name deepseek-ai/DeepSeek-R1-Distill-Llama-8B \

examples/backends/sglang/launch/disagg_same_gpu.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,12 @@ trap cleanup EXIT INT TERM
3737

3838

3939
# run ingress with KV router mode for disaggregated setup
40-
python3 -m dynamo.frontend --router-mode kv --http-port=8000 &
40+
# dynamo.frontend accepts either --http-port flag or DYN_HTTP_PORT env var (defaults to 8000)
41+
python3 -m dynamo.frontend --router-mode kv &
4142
DYNAMO_PID=$!
4243

4344
# run prefill worker with metrics on port 8081
44-
DYN_SYSTEM_PORT=8081 \
45+
DYN_SYSTEM_PORT=${DYN_SYSTEM_PORT1:-8081} \
4546
python3 -m dynamo.sglang \
4647
--model-path Qwen/Qwen3-0.6B \
4748
--served-model-name Qwen/Qwen3-0.6B \
@@ -71,7 +72,7 @@ echo "Waiting for prefill worker to initialize..."
7172
sleep 5
7273

7374
# run decode worker with metrics on port 8082 (foreground)
74-
DYN_SYSTEM_PORT=8082 \
75+
DYN_SYSTEM_PORT=${DYN_SYSTEM_PORT2:-8082} \
7576
python3 -m dynamo.sglang \
7677
--model-path Qwen/Qwen3-0.6B \
7778
--served-model-name Qwen/Qwen3-0.6B \

examples/backends/sglang/launch/multimodal_agg.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ if [[ -n "$SERVED_MODEL_NAME" ]]; then
6060
fi
6161

6262
# run ingress
63-
python3 -m dynamo.frontend --http-port=8000 &
63+
# dynamo.frontend accepts either --http-port flag or DYN_HTTP_PORT env var (defaults to 8000)
64+
python3 -m dynamo.frontend &
6465
DYNAMO_PID=$!
6566

6667
# run SGLang multimodal processor

examples/backends/sglang/launch/multimodal_disagg.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ if [[ -n "$SERVED_MODEL_NAME" ]]; then
6060
fi
6161

6262
# run ingress
63-
python3 -m dynamo.frontend --http-port=8000 &
63+
# dynamo.frontend accepts either --http-port flag or DYN_HTTP_PORT env var (defaults to 8000)
64+
python3 -m dynamo.frontend &
6465
DYNAMO_PID=$!
6566

6667
# run SGLang multimodal processor

examples/backends/trtllm/launch/agg.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ trap cleanup EXIT INT TERM
2222

2323

2424
# run frontend
25-
python3 -m dynamo.frontend --http-port 8000 &
25+
# dynamo.frontend accepts either --http-port flag or DYN_HTTP_PORT env var (defaults to 8000)
26+
python3 -m dynamo.frontend &
2627
DYNAMO_PID=$!
2728

2829
# run worker

examples/backends/trtllm/launch/agg_metrics.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@ cleanup() {
1919
trap cleanup EXIT INT TERM
2020

2121
# Run frontend
22-
python3 -m dynamo.frontend --http-port 8000 &
22+
# dynamo.frontend accepts either --http-port flag or DYN_HTTP_PORT env var (defaults to 8000)
23+
python3 -m dynamo.frontend &
2324
DYNAMO_PID=$!
2425

2526
# Run worker
26-
DYN_SYSTEM_PORT=8081 \
27+
DYN_SYSTEM_PORT=${DYN_SYSTEM_PORT:-8081} \
2728
python3 -m dynamo.trtllm \
2829
--model-path "$MODEL_PATH" \
2930
--served-model-name "$SERVED_MODEL_NAME" \

0 commit comments

Comments
 (0)