Skip to content

Commit 9cc6d50

Browse files
Albert Cheng (Engrg-Hardware 1)Albert Cheng
authored andcommitted
Make Dynamo source install container-agnostic (vLLM, SGLang, etc.)
Auto-detect container type at runtime: if /sgl-workspace exists (SGLang), use original install path unchanged; otherwise use portable /tmp build path with conditional dependency installation for non-SGLang containers.
1 parent fdb10f6 commit 9cc6d50

2 files changed

Lines changed: 39 additions & 3 deletions

File tree

src/srtctl/core/schema.py

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -719,8 +719,8 @@ def get_install_commands(self) -> str:
719719
git_ref = self.hash if self.hash else "HEAD"
720720
checkout_cmd = f"git checkout {self.hash}" if self.hash else ""
721721

722-
return (
723-
f"echo 'Installing dynamo from source ({git_ref})...' && "
722+
# Original SGLang container path, UNCHANGED
723+
sglang = (
724724
"apt-get update -qq && apt-get install -y -qq libclang-dev > /dev/null 2>&1 && "
725725
"cd /sgl-workspace/ && "
726726
"git clone https://github.com/ai-dynamo/dynamo.git && "
@@ -736,6 +736,34 @@ def get_install_commands(self) -> str:
736736
f"echo 'Dynamo installed from source ({git_ref})'"
737737
)
738738

739+
# Portable path for non-SGLang containers (vLLM, etc.)
740+
portable = (
741+
"if ! command -v cargo &> /dev/null || ! command -v maturin &> /dev/null; then "
742+
"apt-get update -qq && apt-get install -y -qq git curl libclang-dev protobuf-compiler > /dev/null 2>&1 && "
743+
"if ! command -v cargo &> /dev/null; then "
744+
"curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && source $HOME/.cargo/env; fi && "
745+
"if ! command -v maturin &> /dev/null; then "
746+
"pip install --break-system-packages maturin; fi; fi && "
747+
"ORIG_DIR=$(pwd) && rm -rf /tmp/dynamo_build && mkdir -p /tmp/dynamo_build && cd /tmp/dynamo_build && "
748+
"git clone https://github.com/ai-dynamo/dynamo.git && "
749+
"cd dynamo && "
750+
f"{checkout_cmd + ' && ' if checkout_cmd else ''}"
751+
"cd lib/bindings/python/ && "
752+
'export RUSTFLAGS="${RUSTFLAGS:-} -C target-cpu=native --cfg tokio_unstable" && '
753+
"rm -f /tmp/ai_dynamo_runtime*.whl && "
754+
"maturin build -o /tmp && "
755+
"pip install --break-system-packages /tmp/ai_dynamo_runtime*.whl --force-reinstall && "
756+
"cd /tmp/dynamo_build/dynamo/ && "
757+
"pip install --break-system-packages -e . && "
758+
"cd $ORIG_DIR && "
759+
f"echo 'Dynamo installed from source ({git_ref})'"
760+
)
761+
762+
return (
763+
f"echo 'Installing dynamo from source ({git_ref})...' && "
764+
f"if [ -d /sgl-workspace ]; then {sglang}; else {portable}; fi"
765+
)
766+
739767
Schema: ClassVar[type[Schema]] = Schema
740768

741769

tests/test_configs.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,11 @@ def test_hash_install_command(self):
127127
assert "git clone" in cmd
128128
assert "git checkout abc123" in cmd
129129
assert "maturin build" in cmd
130-
assert "pip install -e" in cmd
130+
assert "if [ -d /sgl-workspace ]" in cmd
131+
assert "/tmp/dynamo_build" in cmd
132+
assert "protobuf-compiler" in cmd
133+
assert "if ! command -v cargo" in cmd
134+
assert "if ! command -v maturin" in cmd
131135

132136
def test_top_of_tree_install_command(self):
133137
"""Top-of-tree config generates source install without checkout."""
@@ -140,6 +144,10 @@ def test_top_of_tree_install_command(self):
140144
assert "git clone" in cmd
141145
assert "git checkout" not in cmd
142146
assert "maturin build" in cmd
147+
assert "if [ -d /sgl-workspace ]" in cmd
148+
assert "/tmp/dynamo_build" in cmd
149+
assert "--break-system-packages" in cmd
150+
assert "--force-reinstall" in cmd
143151

144152
def test_hash_and_top_of_tree_not_allowed(self):
145153
"""Cannot specify both hash and top_of_tree."""

0 commit comments

Comments
 (0)