Files
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 lines
755 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""
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!")