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
vllm_cscc
Commits
fa839565
Unverified
Commit
fa839565
authored
Jul 16, 2025
by
Reid
Committed by
GitHub
Jul 15, 2025
Browse files
[Misc] Refactor: Improve argument handling for `conda` command (#20481)
Signed-off-by:
reidliu41
<
reid201711@gmail.com
>
parent
75a99b98
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
20 deletions
+25
-20
vllm/collect_env.py
vllm/collect_env.py
+25
-20
No files found.
vllm/collect_env.py
View file @
fa839565
...
@@ -96,6 +96,7 @@ DEFAULT_PIP_PATTERNS = {
...
@@ -96,6 +96,7 @@ DEFAULT_PIP_PATTERNS = {
def
run
(
command
):
def
run
(
command
):
"""Return (return-code, stdout, stderr)."""
"""Return (return-code, stdout, stderr)."""
shell
=
True
if
type
(
command
)
is
str
else
False
shell
=
True
if
type
(
command
)
is
str
else
False
try
:
p
=
subprocess
.
Popen
(
command
,
p
=
subprocess
.
Popen
(
command
,
stdout
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
...
@@ -116,6 +117,10 @@ def run(command):
...
@@ -116,6 +117,10 @@ def run(command):
err
=
raw_err
.
decode
(
enc
)
err
=
raw_err
.
decode
(
enc
)
return
rc
,
output
,
err
.
strip
()
return
rc
,
output
,
err
.
strip
()
except
FileNotFoundError
:
cmd_str
=
command
if
isinstance
(
command
,
str
)
else
command
[
0
]
return
127
,
''
,
f
"Command not found:
{
cmd_str
}
"
def
run_and_read_all
(
run_lambda
,
command
):
def
run_and_read_all
(
run_lambda
,
command
):
"""Run command using run_lambda; reads and returns entire output if rc is 0."""
"""Run command using run_lambda; reads and returns entire output if rc is 0."""
...
@@ -148,7 +153,7 @@ def get_conda_packages(run_lambda, patterns=None):
...
@@ -148,7 +153,7 @@ def get_conda_packages(run_lambda, patterns=None):
if
patterns
is
None
:
if
patterns
is
None
:
patterns
=
DEFAULT_CONDA_PATTERNS
patterns
=
DEFAULT_CONDA_PATTERNS
conda
=
os
.
environ
.
get
(
'CONDA_EXE'
,
'conda'
)
conda
=
os
.
environ
.
get
(
'CONDA_EXE'
,
'conda'
)
out
=
run_and_read_all
(
run_lambda
,
"{} list"
.
format
(
conda
)
)
out
=
run_and_read_all
(
run_lambda
,
[
conda
,
'list'
]
)
if
out
is
None
:
if
out
is
None
:
return
out
return
out
...
...
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