mirror of
https://github.com/Websoft9/websoft9.git
synced 2025-01-24 18:30:23 +08:00
Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
06b449c1a3
@ -10,24 +10,22 @@ from api.utils.common_log import myLogger
|
|||||||
|
|
||||||
def get_process_perc(app_name, real_name):
|
def get_process_perc(app_name, real_name):
|
||||||
|
|
||||||
process_now = "pulling"
|
process_now = "step1"
|
||||||
image_name = real_name
|
|
||||||
if real_name == "codeserver":
|
if if_app_exits(app_name):
|
||||||
image_name = "code-server"
|
process_now = "step2"
|
||||||
elif real_name == "codeserver2":
|
process_now = "step3"
|
||||||
image_name = "code-server2"
|
|
||||||
output = shell_execute.execute_command_output_all("sudo docker image list |grep " + image_name)
|
|
||||||
code = output["code"]
|
|
||||||
if int(code) == 0 and output["result"] != "":
|
|
||||||
process_now = "starting"
|
|
||||||
|
|
||||||
output = shell_execute.execute_command_output_all("docker inspect " + app_name + "|grep error")
|
|
||||||
code = output["code"]
|
|
||||||
if int(code) == 0 and output["result"] == "":
|
|
||||||
process_now = "Initializing"
|
|
||||||
|
|
||||||
return process_now
|
return process_now
|
||||||
|
|
||||||
|
def if_app_exits(app_name):
|
||||||
|
cmd = "docker compose ls -a | grep \'"+app_name+"\\b\'"
|
||||||
|
output = shell_execute.execute_command_output_all(cmd)
|
||||||
|
if int(output["code"]) == -1:
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
return True
|
||||||
|
|
||||||
def check_vm_resource(app_name):
|
def check_vm_resource(app_name):
|
||||||
myLogger.info_logger("Checking virtual memory resource ...")
|
myLogger.info_logger("Checking virtual memory resource ...")
|
||||||
cpu_count = p.cpu_count()
|
cpu_count = p.cpu_count()
|
||||||
|
Loading…
Reference in New Issue
Block a user