Skip to content

Commit 9cf01bc

Browse files
committed
[Misc] add collect_env to cli and docker image
Signed-off-by: rongfu.leng <[email protected]>
1 parent 05fcd1b commit 9cf01bc

File tree

9 files changed

+54
-12
lines changed

9 files changed

+54
-12
lines changed

.github/ISSUE_TEMPLATE/200-installation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ body:
1414
description: |
1515
Please run the following and paste the output below.
1616
```sh
17-
wget https://raw.githubusercontent.com/vllm-project/vllm/main/collect_env.py
17+
wget https://raw.githubusercontent.com/vllm-project/vllm/main/vllm/collect_env.py
1818
# For security purposes, please feel free to check the contents of collect_env.py before running it.
1919
python collect_env.py
2020
```

.github/ISSUE_TEMPLATE/300-usage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ body:
1414
description: |
1515
Please run the following and paste the output below.
1616
```sh
17-
wget https://raw.githubusercontent.com/vllm-project/vllm/main/collect_env.py
17+
wget https://raw.githubusercontent.com/vllm-project/vllm/main/vllm/collect_env.py
1818
# For security purposes, please feel free to check the contents of collect_env.py before running it.
1919
python collect_env.py
2020
```

.github/ISSUE_TEMPLATE/400-bug-report.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ body:
1414
description: |
1515
Please run the following and paste the output below.
1616
```sh
17-
wget https://raw.githubusercontent.com/vllm-project/vllm/main/collect_env.py
17+
wget https://raw.githubusercontent.com/vllm-project/vllm/main/vllm/collect_env.py
1818
# For security purposes, please feel free to check the contents of collect_env.py before running it.
1919
python collect_env.py
2020
```

.github/ISSUE_TEMPLATE/700-performance-discussion.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ body:
3535
description: |
3636
Please run the following and paste the output below.
3737
```sh
38-
wget https://raw.githubusercontent.com/vllm-project/vllm/main/collect_env.py
38+
wget https://raw.githubusercontent.com/vllm-project/vllm/main/vllm/collect_env.py
3939
# For security purposes, please feel free to check the contents of collect_env.py before running it.
4040
python collect_env.py
4141
```

docker/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ if [ "$TARGETPLATFORM" != "linux/arm64" ]; then \
241241
fi
242242
COPY examples examples
243243
COPY benchmarks benchmarks
244+
COPY ./vllm/collect_env.py .
244245

245246
# Although we build Flashinfer with AOT mode, there's still
246247
# some issues w.r.t. JIT compilation. Therefore we need to

docker/Dockerfile.cpu

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ RUN --mount=type=cache,target=/root/.cache/uv \
121121
ADD ./tests/ ./tests/
122122
ADD ./examples/ ./examples/
123123
ADD ./benchmarks/ ./benchmarks/
124+
ADD ./vllm/collect_env.py .
124125

125126
# install development dependencies (for testing)
126127
RUN --mount=type=cache,target=/root/.cache/uv \

collect_env.py renamed to vllm/collect_env.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -283,12 +283,13 @@ def get_vllm_version():
283283
if __version__ == "dev":
284284
return "N/A (dev)"
285285

286-
if len(__version_tuple__) == 4: # dev build
287-
git_sha = __version_tuple__[-1][1:] # type: ignore
286+
if len(__version_tuple__) == 4: # dev build
287+
git_sha = __version_tuple__[-1][1:] # type: ignore
288288
return f"{__version__} (git sha: {git_sha}"
289289

290290
return __version__
291291

292+
292293
def summarize_vllm_build_flags():
293294
# This could be a static method if the flags are constant, or dynamic if you need to check environment variables, etc.
294295
return 'CUDA Archs: {}; ROCm: {}; Neuron: {}'.format(
@@ -502,7 +503,9 @@ def run_with_pip():
502503
print("uv is set")
503504
cmd = ["uv", "pip", "list", "--format=freeze"]
504505
else:
505-
raise RuntimeError("Could not collect pip list output (pip or uv module not available)")
506+
raise RuntimeError(
507+
"Could not collect pip list output (pip or uv module not available)"
508+
)
506509

507510
out = run_and_read_all(run_lambda, cmd)
508511
return "\n".join(line for line in out.splitlines()
@@ -535,13 +538,12 @@ def is_xnnpack_available():
535538
else:
536539
return "N/A"
537540

541+
538542
def get_env_vars():
539543
env_vars = ''
540-
secret_terms=('secret', 'token', 'api', 'access', 'password')
541-
report_prefix = ("TORCH", "NCCL", "PYTORCH",
542-
"CUDA", "CUBLAS", "CUDNN",
543-
"OMP_", "MKL_",
544-
"NVIDIA")
544+
secret_terms = ('secret', 'token', 'api', 'access', 'password')
545+
report_prefix = ("TORCH", "NCCL", "PYTORCH", "CUDA", "CUBLAS", "CUDNN",
546+
"OMP_", "MKL_", "NVIDIA")
545547
for k, v in os.environ.items():
546548
if any(term in k.lower() for term in secret_terms):
547549
continue
@@ -552,6 +554,7 @@ def get_env_vars():
552554

553555
return env_vars
554556

557+
555558
def get_env_info():
556559
run_lambda = run
557560
pip_version, pip_list_output = get_pip_packages(run_lambda)

vllm/entrypoints/cli/collect_env.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
import argparse
4+
5+
from vllm.collect_env import main as collect_env_main
6+
from vllm.entrypoints.cli.types import CLISubcommand
7+
from vllm.entrypoints.openai.cli_args import make_arg_parser
8+
from vllm.utils import FlexibleArgumentParser
9+
10+
11+
class CollectEnvSubcommand(CLISubcommand):
12+
"""The `serve` subcommand for the vLLM CLI. """
13+
14+
def __init__(self):
15+
self.name = "collect-env"
16+
super().__init__()
17+
18+
@staticmethod
19+
def cmd(args: argparse.Namespace) -> None:
20+
"""Collect information about the environment."""
21+
collect_env_main()
22+
23+
def subparser_init(
24+
self,
25+
subparsers: argparse._SubParsersAction) -> FlexibleArgumentParser:
26+
serve_parser = subparsers.add_parser(
27+
"collect-env",
28+
help="Start collecting environment information.",
29+
description="Start collecting environment information.",
30+
usage="vllm collect-env")
31+
return make_arg_parser(serve_parser)
32+
33+
34+
def cmd_init() -> list[CLISubcommand]:
35+
return [CollectEnvSubcommand()]

vllm/entrypoints/cli/main.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import sys
66

77
import vllm.entrypoints.cli.benchmark.main
8+
import vllm.entrypoints.cli.collect_env
89
import vllm.entrypoints.cli.openai
910
import vllm.entrypoints.cli.serve
1011
import vllm.version
@@ -15,6 +16,7 @@
1516
vllm.entrypoints.cli.openai,
1617
vllm.entrypoints.cli.serve,
1718
vllm.entrypoints.cli.benchmark.main,
19+
vllm.entrypoints.cli.collect_env,
1820
]
1921

2022

0 commit comments

Comments
 (0)