Skip to content

Commit 2565243

Browse files
authored
feat: add --runtime-check flag to sanity_check.py (#4102)
Signed-off-by: Keiven Chang <[email protected]> Co-authored-by: Keiven Chang <[email protected]>
1 parent 5128e2b commit 2565243

File tree

1 file changed

+51
-16
lines changed

1 file changed

+51
-16
lines changed

deploy/sanity_check.py

Lines changed: 51 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,12 @@
8686
└─ ✅ dynamo.vllm $HOME/dynamo/components/src/dynamo/vllm/__init__.py
8787
8888
Usage:
89-
python deploy/sanity_check.py [--thorough-check] [--terse]
89+
python deploy/sanity_check.py [--thorough-check] [--terse] [--runtime-check]
9090
9191
Options:
9292
--thorough-check Enable thorough checking (file permissions, directory sizes, HuggingFace model details)
9393
--terse Enable terse output mode (show only essential info and errors)
94+
--runtime-check Skip compile-time dependency checks (Rust, Cargo, Maturin) for runtime containers
9495
"""
9596

9697
import datetime
@@ -297,9 +298,11 @@ def __init__(
297298
hostname: Optional[str] = None,
298299
thorough_check: bool = False,
299300
terse: bool = False,
301+
runtime_check: bool = False,
300302
):
301303
self.thorough_check = thorough_check
302304
self.terse = terse
305+
self.runtime_check = runtime_check
303306
if hostname is None:
304307
hostname = platform.node()
305308

@@ -332,16 +335,22 @@ def __init__(
332335
# In terse mode, only add other components if they have errors
333336
if not self.terse:
334337
# Add file permissions check
335-
self.add_child(FilePermissionsInfo(thorough_check=self.thorough_check))
338+
self.add_child(
339+
FilePermissionsInfo(
340+
thorough_check=self.thorough_check, runtime_check=self.runtime_check
341+
)
342+
)
336343

337344
# Add HuggingFace cache check
338345
self.add_child(HuggingFaceInfo(thorough_check=self.thorough_check))
339346

340-
# Add Cargo (always show, even if not found)
341-
self.add_child(CargoInfo(thorough_check=self.thorough_check))
347+
# Skip compile-time dependencies in runtime-check mode
348+
if not self.runtime_check:
349+
# Add Cargo (always show, even if not found)
350+
self.add_child(CargoInfo(thorough_check=self.thorough_check))
342351

343-
# Add Maturin (Python-Rust build tool)
344-
self.add_child(MaturinInfo())
352+
# Add Maturin (Python-Rust build tool)
353+
self.add_child(MaturinInfo())
345354

346355
# Add Python info
347356
self.add_child(PythonInfo())
@@ -389,12 +398,24 @@ def _add_error_only_components(self) -> None:
389398
"""In terse mode, only add components that have errors"""
390399
# Create components and check their status
391400
components_to_check = [
392-
("File System", FilePermissionsInfo(thorough_check=self.thorough_check)),
393-
("Cargo", CargoInfo(thorough_check=self.thorough_check)),
394-
("Maturin", MaturinInfo()),
401+
(
402+
"File System",
403+
FilePermissionsInfo(
404+
thorough_check=self.thorough_check, runtime_check=self.runtime_check
405+
),
406+
),
395407
("Python", PythonInfo()),
396408
]
397409

410+
# Skip compile-time dependencies in runtime-check mode
411+
if not self.runtime_check:
412+
components_to_check.extend(
413+
[
414+
("Cargo", CargoInfo(thorough_check=self.thorough_check)),
415+
("Maturin", MaturinInfo()),
416+
]
417+
)
418+
398419
for name, component in components_to_check:
399420
# Only add if the component has an error status
400421
if component.status == NodeStatus.ERROR:
@@ -721,28 +742,33 @@ class FilePermissionsInfo(NodeInfo):
721742
722743
Checks writability of critical directories needed for:
723744
- Dynamo development (top-level dynamo directory)
724-
- Rust development (Cargo target directory + all files, RUSTUP_HOME, CARGO_HOME)
745+
- Rust development (Cargo target directory + all files, RUSTUP_HOME, CARGO_HOME) - skipped in runtime_check mode
725746
- Python development (site-packages)
726747
727748
In thorough mode, also checks disk space for the dynamo working directory
728749
and shows a warning if less than 10% free space is available.
729750
730751
In fast mode, skips recursive file checking in Cargo target directory
731752
for improved performance on large target directories.
753+
754+
In runtime_check mode, skips Rust/Cargo toolchain checks.
732755
"""
733756

734-
def __init__(self, thorough_check: bool = False):
757+
def __init__(self, thorough_check: bool = False, runtime_check: bool = False):
735758
super().__init__(label="File System", status=NodeStatus.INFO)
736759
self.thorough_check = thorough_check
760+
self.runtime_check = runtime_check
737761

738762
# Check top-level dynamo directory
739763
self._check_dynamo_directory_permissions()
740764

741-
# Check Rust toolchain directories (RUSTUP_HOME and CARGO_HOME)
742-
self._check_rust_toolchain_permissions()
765+
# Skip Rust toolchain checks in runtime-check mode
766+
if not self.runtime_check:
767+
# Check Rust toolchain directories (RUSTUP_HOME and CARGO_HOME)
768+
self._check_rust_toolchain_permissions()
743769

744-
# Check Cargo target directory (with optional recursive file checking)
745-
self._check_cargo_target_permissions()
770+
# Check Cargo target directory (with optional recursive file checking)
771+
self._check_cargo_target_permissions()
746772

747773
# Check Python site-packages directory
748774
self._check_site_packages_permissions()
@@ -2485,14 +2511,23 @@ def main():
24852511
action="store_true",
24862512
help="Show only essential information (OS, User, GPU, Framework, Dynamo) and errors",
24872513
)
2514+
parser.add_argument(
2515+
"--runtime-check",
2516+
action="store_true",
2517+
help="Skip compile-time dependency checks (Rust, Cargo, Maturin) for runtime containers",
2518+
)
24882519
args = parser.parse_args()
24892520

24902521
# Validate mutual exclusion
24912522
if args.thorough_check and args.terse:
24922523
parser.error("--thorough-check and --terse cannot be used together")
24932524

24942525
# Simply create a SystemInfo instance - it collects everything in its constructor
2495-
tree = SystemInfo(thorough_check=args.thorough_check, terse=args.terse)
2526+
tree = SystemInfo(
2527+
thorough_check=args.thorough_check,
2528+
terse=args.terse,
2529+
runtime_check=args.runtime_check,
2530+
)
24962531
tree.print_tree()
24972532

24982533
# Check if there are framework component errors and show installation recommendation

0 commit comments

Comments
 (0)