项目文件夹

文件
wehub-resource-sync 8153d5ec9f
Python package / build (3.10) (push) Successful in 8m51s
chore: import upstream snapshot with attribution
2026-07-13 12:35:30 +08:00

25 行
755 B
Python

此文件含有模棱两可的 Unicode 字符
此文件含有可能会与其他字符混淆的 Unicode 字符。 如果您是想特意这样的,可以安全地忽略该警告。 使用 Escape 按钮显示他们。
"""
Usage
python shutdown_serve.py --down all
options: "all","controller","model_worker","openai_api_server", `all` means to stop all related servers
"""
import argparse
import os
import subprocess
parser = argparse.ArgumentParser()
parser.add_argument(
"--down", choices=["all", "controller", "model_worker", "openai_api_server"]
)
args = parser.parse_args()
base_shell = "ps -eo user,pid,cmd|grep fastchat.serve{}|grep -v grep|awk '{{print $2}}'|xargs kill -9"
if args.down == "all":
shell_script = base_shell.format("")
else:
serve = f".{args.down}"
shell_script = base_shell.format(serve)
print(f"execute shell cmd: {shell_script}")
subprocess.run(shell_script, shell=True, check=True)
print(f"{args.down} has been shutdown!")