gstlal_ll_inspiral_event_plotter: fix stale event clean up and change elifs to ifs
Various bug fixes to get this program running smoothly:
Corrupted coinc files
We have seen that this program periodically fails (on a cadence of once every few hours) with this error:
Traceback (most recent call last):
File "/usr/bin/gstlal_ll_inspiral_event_plotter", line 552, in <module>
event_plotter.start()
File "/usr/lib64/python3.6/site-packages/gstlal/events.py", line 122, in start
self.process()
File "/usr/lib64/python3.6/site-packages/gstlal/events.py", line 111, in process
self.handle()
File "/usr/bin/gstlal_ll_inspiral_event_plotter", line 236, in handle
self.upload_ranking_plots(event)
File "/usr/bin/gstlal_ll_inspiral_event_plotter", line 328, in upload_ranking_plots
sngl_inspirals = dict((row.ifo, row) for row in lsctables.SnglInspiralTable.get_table(event['coinc']))
File "/usr/lib64/python3.6/site-packages/ligo/lw/table.py", line 606, in get_table
raise ValueError("document must contain exactly one %s table" % cls.TableName(name))
ValueError: document must contain exactly one sngl_inspiral table
Carefully debugging this, I found that the coinc files were getting corrupted during the stale event clean up in handle()
. Then downstream we get this error when trying to use the coinc file to make additional plots since all the content had been removed from the coinc files. I reverted the last commit made to this part of the code (which was fixing an error due to removing events from the self.events
dict while iterating over it) and replaced it with a simpler solution. I also cleaned up some of the logic around this part of the code in general.
Incorrect elif logic
I also found that the elifs
that control generating the various plots for each event in the handle()
method are not correct. Each of the functions:
self.upload_ranking_data
self.upload_ranking_plots
self.upload_psd_plots
self.upload_snr_plots
are independent and there's no reason why they shouldn't all get executed during one iteration of the events loop. Changing them to ifs
means that plots are generated and uploaded as soon as possible.