@@ -121,23 +121,29 @@ def list_statistics():
121
121
result = connection .execute (s )
122
122
last_execution_details = result .fetchone ()[0 ]
123
123
124
-
125
124
except Exception as e :
126
- current_app .logger .error ("Failure reading Last Execution stats from DB" )
127
- # return abort(500) # Weird but not worth a 500
125
+ current_app .logger .warning ("Failure reading Last Execution stats from DB" )
126
+ # Will heppen on first run, shouldn't after
128
127
129
128
return last_execution_details
130
129
131
130
132
131
@admin_api .route ("/api/get_execution_status/<int:job_id>" , methods = ["GET" ])
133
132
def get_exec_status (job_id ):
134
- kvt = Table ("kv_unique" , metadata , autoload = True , autoload_with = engine )
133
+ """ Get the execution status record from the DB for the specified job_id """
134
+ kvt = Table ("kv_unique" , metadata , autoload = True , autoload_with = engine ) #TODO: Don't think we need this or Metadata import
135
+
136
+ exec_status = '{}'
137
+
135
138
with engine .connect () as connection :
136
139
s_jobid = 'job-' + str (job_id )
137
140
s = text ("select valcol from kv_unique where keycol = :j ;" )
138
141
s = s .bindparams (j = s_jobid )
139
142
result = connection .execute (s )
140
- exec_status = result .fetchone ()[0 ]
143
+ if result .rowcount > 0 :
144
+ exec_status = result .fetchone ()[0 ]
145
+ else :
146
+ current_app .logger .warning ("Failure reading Execution Status from DB" )
141
147
142
148
return exec_status
143
149
0 commit comments