2023-11-07 19:44:47 +08:00
|
|
|
import docker, sys, os
|
|
|
|
from loguru import logger
|
|
|
|
|
|
|
|
src_dir = os.path.join(
|
|
|
|
os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
)
|
|
|
|
sys.path.append(src_dir)
|
|
|
|
|
|
|
|
from configs.server_config import (
|
|
|
|
SANDBOX_CONTRAINER_NAME, CONTRAINER_NAME, SANDBOX_SERVER, DOCKER_SERVICE
|
|
|
|
)
|
|
|
|
|
|
|
|
from start import check_docker, check_process
|
|
|
|
|
2023-11-29 12:21:43 +08:00
|
|
|
try:
|
|
|
|
client = docker.from_env()
|
|
|
|
except:
|
|
|
|
client = None
|
2023-11-07 19:44:47 +08:00
|
|
|
|
2024-03-28 20:12:36 +08:00
|
|
|
|
|
|
|
def stop_main():
|
|
|
|
#
|
|
|
|
check_docker(client, SANDBOX_CONTRAINER_NAME, do_stop=True, )
|
|
|
|
check_process(f"port={SANDBOX_SERVER['port']}", do_stop=True)
|
|
|
|
check_process(f"port=5050", do_stop=True)
|
|
|
|
|
|
|
|
#
|
|
|
|
check_docker(client, CONTRAINER_NAME, do_stop=True, )
|
|
|
|
check_process("api.py", do_stop=True)
|
|
|
|
check_process("sdfile_api.py", do_stop=True)
|
|
|
|
check_process("llm_api.py", do_stop=True)
|
|
|
|
check_process("webui.py", do_stop=True)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
stop_main()
|