Tiny print launch command with shlex (#16010)

This commit is contained in:
Liangsheng Yin
2025-12-29 11:26:46 +08:00
committed by GitHub
parent 2ec6fa3c54
commit a435f55d18
4 changed files with 11 additions and 7 deletions
@@ -1,12 +1,13 @@
""" """
This generates gpu kernel analysis output from nsys rep. Will call nsys This generates gpu kernel analysis output from nsys rep. Will call nsys
stats -r cuda_gpu_kern_trace, get non-overlapped gpu cycles, then generate stats -r cuda_gpu_kern_trace, get non-overlapped gpu cycles, then generate
csv and html output for analysis csv and html output for analysis
""" """
import argparse import argparse
import logging import logging
import os import os
import shlex
import regex as re import regex as re
@@ -223,7 +224,7 @@ class GPUTrace2Graph:
"-o", "-o",
f"{file_dir}/{file_name}", f"{file_dir}/{file_name}",
] ]
cmd_str = " ".join(cmd) cmd_str = shlex.join(cmd)
logger.info("+ %s", cmd_str) logger.info("+ %s", cmd_str)
# estimate time based on calibrated 240M/min # estimate time based on calibrated 240M/min
file_size_mb = os.path.getsize(file) / 1e6 file_size_mb = os.path.getsize(file) / 1e6
@@ -4,6 +4,7 @@
import argparse import argparse
import os import os
import shlex
import subprocess import subprocess
import sys import sys
@@ -53,7 +54,7 @@ def launch_distributed(
cmd.extend(args) cmd.extend(args)
logger.info("Running inference with %d GPU(s)", num_gpus) logger.info("Running inference with %d GPU(s)", num_gpus)
logger.info("Launching command: %s", " ".join(cmd)) logger.info("Launching command: %s", shlex.join(cmd))
current_env["PYTHONIOENCODING"] = "utf-8" current_env["PYTHONIOENCODING"] = "utf-8"
process = subprocess.Popen( process = subprocess.Popen(
@@ -1,5 +1,6 @@
import logging import logging
import os import os
import shlex
import time import time
import warnings import warnings
from urllib.parse import urlparse from urllib.parse import urlparse
@@ -69,7 +70,7 @@ class PDDisaggregationServerBase(CustomTestCase):
"--port", "--port",
cls.lb_port, cls.lb_port,
] ]
print("Starting load balancer:", " ".join(lb_command)) print("Starting load balancer:", shlex.join(lb_command))
cls.process_lb = popen_with_error_check(lb_command) cls.process_lb = popen_with_error_check(lb_command)
cls.wait_server_ready(cls.lb_url + "/health") cls.wait_server_ready(cls.lb_url + "/health")
+2 -1
View File
@@ -8,6 +8,7 @@ import logging
import os import os
import random import random
import re import re
import shlex
import subprocess import subprocess
import sys import sys
import threading import threading
@@ -632,7 +633,7 @@ def popen_launch_server(
if api_key: if api_key:
command += ["--api-key", api_key] command += ["--api-key", api_key]
print(f"command={' '.join(command)}") print(f"command={shlex.join(command)}")
if return_stdout_stderr: if return_stdout_stderr:
process = subprocess.Popen( process = subprocess.Popen(