@@ -279,9 +279,9 @@ def run_rate(instrument_id, n_hours=24):
279279 rows = cursor .fetchall ()
280280 cursor .close ()
281281 return [[int (r [0 ]), int (r [1 ])] for r in rows ]
282- except Exception as e :
282+ except Exception :
283283 connection .close ()
284- logging .exception ("Call to stored procedure run_rate(%s) failed: %s " , str (instrument_id ), str ( e ))
284+ logging .exception ("Call to stored procedure run_rate(%s) failed" , str (instrument_id ))
285285
286286 # Do it by hand (slow)
287287 time = timezone .now ()
@@ -294,6 +294,9 @@ def run_rate(instrument_id, n_hours=24):
294294 running_sum += n
295295 runs .append ([- i , n ])
296296 return runs
297+ except SystemExit :
298+ logging .exception ("Call to stored procedure error_rate(%s) created system exit" , str (instrument_id ))
299+ raise
297300
298301
299302@transaction .atomic
@@ -331,6 +334,9 @@ def error_rate(instrument_id, n_hours=24):
331334 running_sum += n
332335 errors .append ([- i , n ])
333336 return errors
337+ except SystemExit :
338+ logging .exception ("Call to stored procedure error_rate(%s) created system exit: %s" , str (instrument_id ))
339+ raise
334340
335341
336342def get_current_status (instrument_id ):
@@ -433,6 +439,10 @@ def get_run_list_dict(run_list):
433439 """
434440 run_dicts = []
435441
442+ # return early if provided an empty list
443+ if len (run_list ) == 0 :
444+ return run_dicts
445+
436446 run_status_text_dict = get_run_status_text_dict (run_list , use_element_id = True )
437447
438448 try :
@@ -459,8 +469,11 @@ def get_run_list_dict(run_list):
459469 "status" : run_status_text_dict .get (r .id , "unknown" ),
460470 }
461471 )
462- except : # noqa: E722
463- logging .exception ("report.view_util.get_run_list_dict:" )
472+ except Exception :
473+ logging .exception ("report.view_util.get_run_list_dict: %s" , str (run_list ))
474+ except SystemExit :
475+ logging .exception ("report.view_util.get_run_list_dict SystemExit: %s" , str (run_list ))
476+ raise
464477
465478 return run_dicts
466479
@@ -582,7 +595,7 @@ def get_plot_data_from_server(instrument, run_id, data_type="json"):
582595 if data_request .status_code == 200 :
583596 json_data = data_request .text
584597 except : # noqa: E722
585- logging .exception ("Could not pull data from live data server:" )
598+ logging .exception ("Could not pull data from live data server: %s" , str ( instrument ) )
586599 return json_data
587600
588601
@@ -655,7 +668,7 @@ def find_skipped_runs(instrument_id, start_run_number=0):
655668 if len (query_set ) == 0 :
656669 missing_runs .append (i )
657670 except : # noqa: E722
658- logging .exception ("Error finding missing runs:" )
671+ logging .exception ("Error finding missing runs: %s" , str ( instrument_id ) )
659672 return missing_runs
660673
661674
0 commit comments