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