Skip to content
Snippets Groups Projects

gstlal_ll_inspiral_event_plotter: fix stale event clean up and change elifs to ifs

Merged Rebecca Ewing requested to merge event-plotter into master
All threads resolved!
@@ -222,33 +222,35 @@ class EventPlotter(events.EventProcessor):
if not event['uploaded']['ranking_data'] and event['ranking_data_path']:
self.upload_ranking_data(event)
event['uploaded']['ranking_data'] = True
elif not event['uploaded']['ranking_plots'] and event['ranking_data_path']:
if not event['uploaded']['ranking_plots'] and event['ranking_data_path']:
self.upload_ranking_plots(event)
event['uploaded']['ranking_plots'] = True
elif not event['uploaded']['psd_plots'] and event['psd']:
if not event['uploaded']['psd_plots'] and event['psd']:
self.upload_psd_plots(event)
event['uploaded']['psd_plots'] = True
elif not event['uploaded']['snr_plots']:
if not event['uploaded']['snr_plots']:
self.upload_snr_plots(event)
event['uploaded']['snr_plots'] = True
# clean out old events
# clean out events once all plots are uploaded
# and clean out old events
current_time = utils.gps_now()
events_to_pop = []
for event_key, event in self.events.items():
uploaded = event['uploaded']
if uploaded['ranking_data'] and uploaded['ranking_plots'] and uploaded['psd_plots'] and uploaded['snr_plots']:
event['coinc'].unlink()
event['psd'].unlink()
events_to_pop.append(event_key)
if current_time - event['time'] >= self.max_event_time:
logging.info('removing stale event from {} and bin {}'.format(event['time'], event['bin']))
+2
for event_key, event in copy.copy(self.events).items():
if self.all_plots_uploaded(event['uploaded']) or current_time - event['time'] >= self.max_event_time:
logging.info('removing event from {} and bin {}'.format(event['time'], event['bin']))
if event['coinc'] is not None:
logging.info('Did not receive path of ranking data file associated with event from {} and bin {}'.format(event['time'], event['bin']))
event['coinc'].unlink()
event['psd'].unlink()
events_to_pop.append(event_key)
map(lambda x: self.events.pop(x), events_to_pop)
self.events.pop(event_key)
@staticmethod
def all_plots_uploaded(uploaded):
"""
return True if all plots for
the event have been uploaded
"""
return uploaded['ranking_data'] and uploaded['ranking_plots'] and uploaded['psd_plots'] and uploaded['snr_plots']
def upload_file(self, message, filename, tag, contents, graceid):
"""
Loading