mirror of
https://github.com/Websoft9/websoft9.git
synced 2024-09-29 16:21:32 +00:00
add waiting app check
This commit is contained in:
parent
8f45364fad
commit
3b4164df31
|
@ -215,9 +215,10 @@ def uninstall_app(app_id):
|
|||
def check_app(app_name, customer_app_name, app_version):
|
||||
message = " "
|
||||
code = const.RETURN_FAIL
|
||||
app_id = app_name + "-" + customer_app_name
|
||||
if app_name == None or customer_app_name == None or app_version == None:
|
||||
message = "Please fill in the APP information completely!"
|
||||
elif not docker.check_app_directory(app_name):
|
||||
elif not docker.check_app_websoft9(app_name):
|
||||
message = "Installing the app is not supported!"
|
||||
elif re.match('^[a-z0-9]+$', customer_app_name) == None:
|
||||
message = "App names must be lowercase letters and numbers!"
|
||||
|
@ -225,6 +226,8 @@ def check_app(app_name, customer_app_name, app_version):
|
|||
message = "The APP name is already in use, please specify a different name to reinstall."
|
||||
elif not docker.check_vm_resource(app_name):
|
||||
message = "System resources (memory, CPU, disk) are insufficient, and continuing to install may cause the app to not run or the server to be abnormal!"
|
||||
elif check_app_wait(app_id):
|
||||
message = "The APP name is waiting for install, please rename app to install."
|
||||
else:
|
||||
code = const.RETURN_SUCCESS
|
||||
return code, message
|
||||
|
@ -402,6 +405,15 @@ def check_if_official_app(var_path):
|
|||
return False
|
||||
|
||||
|
||||
def check_app_wait(app_id):
|
||||
myLogger.info_logger("check_app_wait")
|
||||
deferred = DeferredJobRegistry(queue=q)
|
||||
wait_job_ids = deferred.get_job_ids()
|
||||
if app_id in wait_job_ids:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def get_apps_from_queue():
|
||||
myLogger.info_logger("get queque apps...")
|
||||
# 获取 StartedJobRegistry 实例
|
||||
|
|
|
@ -94,7 +94,7 @@ def check_vm_resource(app_name):
|
|||
return True
|
||||
|
||||
|
||||
def check_app_directory(app_name):
|
||||
def check_app_websoft9(app_name):
|
||||
# websoft9's support applist
|
||||
myLogger.info_logger("Checking dir...")
|
||||
path = "/data/library/apps/" + app_name
|
||||
|
|
Loading…
Reference in a new issue