Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
dynamo
Commits
9cbf8031
Unverified
Commit
9cbf8031
authored
Jul 02, 2025
by
ishandhanani
Committed by
GitHub
Jul 02, 2025
Browse files
feat: add dynamo components for sglang (#1721)
parent
008bb1e6
Changes
25
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
96 additions
and
14 deletions
+96
-14
examples/sglang/utils/benchmarking/bench.sh
examples/sglang/utils/benchmarking/bench.sh
+0
-0
examples/sglang/utils/benchmarking/generate_bench_data.py
examples/sglang/utils/benchmarking/generate_bench_data.py
+0
-0
examples/sglang/utils/clear_namespace.py
examples/sglang/utils/clear_namespace.py
+44
-0
examples/sglang/utils/gen_env_vars.sh
examples/sglang/utils/gen_env_vars.sh
+46
-0
examples/sglang/utils/sgl_utils.py
examples/sglang/utils/sgl_utils.py
+6
-14
No files found.
examples/sglang/utils/
deepseek-r1-wideep
/bench.sh
→
examples/sglang/utils/
benchmarking
/bench.sh
View file @
9cbf8031
File moved
examples/sglang/utils/
deepseek-r1-wideep
/generate_bench_data.py
→
examples/sglang/utils/
benchmarking
/generate_bench_data.py
View file @
9cbf8031
File moved
examples/sglang/utils/clear_namespace.py
0 → 100644
View file @
9cbf8031
# SPDX-FileCopyrightText: Copyright (c) 2020 Atalaya Tech. Inc
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
# #
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Modifications Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES
import
argparse
import
asyncio
import
logging
from
dynamo.runtime
import
DistributedRuntime
,
EtcdKvCache
,
dynamo_worker
from
dynamo.runtime.logging
import
configure_dynamo_logging
configure_dynamo_logging
()
logger
=
logging
.
getLogger
(
__name__
)
@
dynamo_worker
()
async
def
clear_namespace
(
runtime
:
DistributedRuntime
,
namespace
:
str
):
etcd_kv_cache
=
await
EtcdKvCache
.
create
(
runtime
.
etcd_client
(),
f
"/
{
namespace
}
/"
,
{},
)
await
etcd_kv_cache
.
clear_all
()
logger
.
info
(
f
"Cleared /
{
namespace
}
in EtcdKvCache"
)
if
__name__
==
"__main__"
:
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"--namespace"
,
type
=
str
,
required
=
True
)
args
=
parser
.
parse_args
()
asyncio
.
run
(
clear_namespace
(
args
.
namespace
))
examples/sglang/utils/gen_env_vars.sh
0 → 100755
View file @
9cbf8031
#!/bin/bash
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
# Helper script to generate environment variables for each node during a multinode SGLang deployment
echo
"=== USAGE ==="
echo
"1. Run this script: ./gen_env_vars.sh"
echo
"2. Enter the IP addresses when prompted"
echo
"3. Copy the commands for the head prefill node and run them"
echo
"4. Copy the commands for all other nodes and run them on each node"
echo
"5. Proceed with starting your prefill and decode workers"
echo
""
# Prompt for IP addresses
read
-p
"Enter HEAD_PREFILL_NODE IP: "
HEAD_PREFILL_NODE
read
-p
"Enter HEAD_DECODE_NODE IP: "
HEAD_DECODE_NODE
# Validate inputs
if
[
-z
"
$HEAD_PREFILL_NODE
"
]
||
[
-z
"
$HEAD_DECODE_NODE
"
]
;
then
echo
"Error: Both IP addresses are required"
exit
1
fi
echo
"=== HEAD PREFILL NODE (
$HEAD_PREFILL_NODE
) ==="
echo
"Run all of these commands on the head prefill node:"
echo
""
echo
"nats-server -js &"
echo
"etcd --listen-client-urls http://0.0.0.0:2379
\\
"
echo
" --advertise-client-urls http://0.0.0.0:2379
\\
"
echo
" --listen-peer-urls http://0.0.0.0:2380
\\
"
echo
" --initial-cluster default=http://
$HEAD_PREFILL_NODE
:2380 &"
echo
"export HEAD_PREFILL_NODE_IP=
$HEAD_PREFILL_NODE
"
echo
"export HEAD_DECODE_NODE_IP=
$HEAD_DECODE_NODE
"
echo
""
echo
"=== ALL OTHER NODES ==="
echo
"Run these commands on all other nodes (prefill and decode):"
echo
""
echo
"# Export environment variables"
echo
"export NATS_SERVER=nats://
$HEAD_PREFILL_NODE
:4222"
echo
"export ETCD_ENDPOINTS=http://
$HEAD_PREFILL_NODE
:2379"
echo
"export HEAD_PREFILL_NODE_IP=
$HEAD_PREFILL_NODE
"
echo
"export HEAD_DECODE_NODE_IP=
$HEAD_DECODE_NODE
"
examples/sglang/utils/sgl_utils.py
View file @
9cbf8031
...
...
@@ -19,26 +19,18 @@ from argparse import Namespace
from
sglang.srt.server_args
import
ServerArgs
from
dynamo.sdk.cli.utils
import
reserve_free_port
from
dynamo.sdk.lib.config
import
ServiceConfig
def
parse_sglang_args
(
service_name
,
prefix
)
->
ServerArgs
:
config
=
ServiceConfig
.
get_instance
()
sglang_args
=
config
.
as_args
(
service_name
,
prefix
=
prefix
)
def
parse_sglang_args_inc
(
args
:
list
[
str
])
->
ServerArgs
:
parser
=
argparse
.
ArgumentParser
()
bootstrap_port
=
_reserve_disaggregation_bootstrap_port
()
# add future dynamo arguments here
ServerArgs
.
add_cli_args
(
parser
)
args
=
parser
.
parse_args
(
sglang_args
)
if
not
any
(
arg
.
startswith
(
"--disaggregation-bootstrap-port"
)
for
arg
in
sglang_args
):
args_dict
=
vars
(
args
)
parsed_args
=
parser
.
parse_args
(
args
)
if
not
any
(
arg
.
startswith
(
"--disaggregation-bootstrap-port"
)
for
arg
in
args
):
args_dict
=
vars
(
parsed_args
)
args_dict
[
"disaggregation_bootstrap_port"
]
=
bootstrap_port
args
=
Namespace
(
**
args_dict
)
return
ServerArgs
.
from_cli_args
(
args
)
parsed_
args
=
Namespace
(
**
args_dict
)
return
ServerArgs
.
from_cli_args
(
parsed_
args
)
def
_reserve_disaggregation_bootstrap_port
():
...
...
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment