From 189b367855fb8373036d1b39c0d589265ac0525b Mon Sep 17 00:00:00 2001 From: qiaofeng1227 <76487013@qq.com> Date: Sun, 16 Apr 2023 21:42:32 +0800 Subject: [PATCH 1/3] Update manage.py --- appmanage/api/service/manage.py | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/appmanage/api/service/manage.py b/appmanage/api/service/manage.py index 9cdd461c..aea2158d 100644 --- a/appmanage/api/service/manage.py +++ b/appmanage/api/service/manage.py @@ -239,18 +239,22 @@ def app_exits_in_docker(app_id): flag = False info = "" cmd = "docker compose ls -a | grep \'/" + app_name + "/\'" - output = shell_execute.execute_command_output_all(cmd) - if int(output["code"]) == 0: - info = output["result"] - app_path = info.split()[-1].rsplit('/', 1)[0] - is_official = check_if_official_app(app_path + '/variables.json') - if is_official: - name = docker.read_var(app_path + '/variables.json', 'name') - if name == app_name: + try: + output = shell_execute.execute_command_output_all(cmd) + if int(output["code"]) == 0: + info = output["result"] + app_path = info.split()[-1].rsplit('/', 1)[0] + is_official = check_if_official_app(app_path + '/variables.json') + if is_official: + name = docker.read_var(app_path + '/variables.json', 'name') + if name == app_name: + flag = True + elif app_name == customer_name: flag = True - elif app_name == customer_name: - flag = True - myLogger.info_logger("APP info: " + info) + myLogger.info_logger("APP in docker") + except CommandException as ce: + myLogger.info_logger("APP not in docker") + return info, flag def split_app_id(app_id): From 4ccedc1f1b016cad0c1c407b42742dd365737cb1 Mon Sep 17 00:00:00 2001 From: qiaofeng1227 <76487013@qq.com> Date: Sun, 16 Apr 2023 21:46:46 +0800 Subject: [PATCH 2/3] Update manage.py --- appmanage/api/service/manage.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/appmanage/api/service/manage.py b/appmanage/api/service/manage.py index aea2158d..b9582161 100644 --- a/appmanage/api/service/manage.py +++ b/appmanage/api/service/manage.py @@ -366,12 +366,15 @@ def check_app_rq(app_id): myLogger.info_logger(run_job_ids) myLogger.info_logger(failed_job_ids) if queue_job_ids and app_id in queue_job_ids: + myLogger.info_logger("App in RQ") return True if failed_job_ids and app_id in failed_job_ids: + myLogger.info_logger("App in RQ") return True if run_job_ids and app_id in run_job_ids: - return True - + myLogger.info_logger("App in RQ") + return True + myLogger.info_logger("App not in RQ") return False def get_apps_from_queue(): From b6d6c841661a67a28539a189e2046712b4bcc3a8 Mon Sep 17 00:00:00 2001 From: qiaofeng1227 <76487013@qq.com> Date: Sun, 16 Apr 2023 21:46:54 +0800 Subject: [PATCH 3/3] Update Dockerfile --- appmanage/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appmanage/Dockerfile b/appmanage/Dockerfile index 9b4ec2ea..8de7ef7c 100644 --- a/appmanage/Dockerfile +++ b/appmanage/Dockerfile @@ -10,7 +10,7 @@ COPY static ./static COPY requirements.txt main.py ./ RUN apt update -# Install supervisords +# Install supervisord RUN apt install -y supervisor COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf COPY config/cmd.sh /cmd.sh