diff --git a/gstlal-inspiral/bin/gstlal_ll_inspiral_event_plotter b/gstlal-inspiral/bin/gstlal_ll_inspiral_event_plotter index bd11ac37f0221575a576f7703b2c8eed1b42ef6e..ef78f266f8b06516c8591ac50deb71ae9a335824 100755 --- a/gstlal-inspiral/bin/gstlal_ll_inspiral_event_plotter +++ b/gstlal-inspiral/bin/gstlal_ll_inspiral_event_plotter @@ -222,32 +222,37 @@ 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() - 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() - self.events.pop(event_key) - if current_time - event['time'] >= self.max_event_time: - logging.info('removing stale event from {} and bin {}'.format(event['time'], event['bin'])) + for event_key in list(self.events.keys()): + event = self.events[event_key] + 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() 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): """ upload a file to gracedb