@@ -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" ])
853852def 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-
0 commit comments