Skip to content

Commit 314fd8e

Browse files
committed
modified the health path
1 parent f8d6f72 commit 314fd8e

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

kuiper/app/controllers/admin_management.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,6 @@ def system_health():
847847

848848

849849

850-
851850
# request to pull current system health information, return json
852851
@app.route('/admin/system_health_pull/', methods=["GET"])
853852
def system_health_pull2():
@@ -856,17 +855,16 @@ def system_health_pull2():
856855
system_health = {}
857856
# read services system health
858857
for service in services:
859-
with open(os.path.join( app.config['SYSTEM_HEALTH_PATH'] , service ) , 'r' ) as sys_health:
860-
system_health[service] = json.load(sys_health)
861-
if 'datetime' in system_health[service].keys():
862-
date_obj = datetime.strptime(system_health[service]['datetime'] , "%Y-%m-%d %H:%M:%S.%f")
863-
date_now = datetime.now()
864-
system_health[service]["datetime_diff"] = (date_now - date_obj).total_seconds()
865-
858+
try:
859+
with open(os.path.join( app.config['SYSTEM_HEALTH_PATH'] , service ) , 'r' ) as sys_health:
860+
system_health[service] = json.load(sys_health)
861+
if 'datetime' in system_health[service].keys():
862+
date_obj = datetime.strptime(system_health[service]['datetime'] , "%Y-%m-%d %H:%M:%S.%f")
863+
date_now = datetime.now()
864+
system_health[service]["datetime_diff"] = (date_now - date_obj).total_seconds()
865+
except Exception as e:
866+
logger.logger(level=logger.WARNING , type="admin", message="Failed reading the service ["+service+"] system health" , reason=str(e))
866867

867868
return json.dumps({"result" : 'success' , 'data' : system_health})
868869

869870

870-
871-
872-

system_health/scheduler.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,9 @@ for variable_value in $(cat /proc/1/environ | sed 's/\x00/\n/g'); do
55
export $variable_value
66
done
77

8-
python3 "/system_health/$1_health.py"
8+
if [ $1="celery" ]
9+
then
10+
python "/system_health/$1_health.py"
11+
else
12+
python3 "/system_health/$1_health.py"
13+
fi

0 commit comments

Comments
 (0)