Skip to content
Snippets Groups Projects
Commit 81784cb3 authored by Kipp Cannon's avatar Kipp Cannon
Browse files

gstlal_inspiral: try fixing a snapshot-at-startup problem

parent ab9d1f75
No related branches found
No related tags found
No related merge requests found
......@@ -191,7 +191,6 @@ import signal
import socket
import sys
import tempfile
import time
import gi
gi.require_version('Gst', '1.0')
......@@ -245,10 +244,6 @@ setrlimit(resource.RLIMIT_RSS, None)
setrlimit(resource.RLIMIT_STACK, 1024 * 1024) # 1 MiB per thread
def now():
return LIGOTimeGPS(lal.UTCToGPS(time.gmtime()))
#
# =============================================================================
#
......@@ -547,7 +542,7 @@ class OneTimeSignalHandler(object):
print >>sys.stderr, "*** SIG %d attempting graceful shutdown (this might take several minutes) ... ***" % signum
try:
#FIXME how do I choose a timestamp?
self.pipeline.get_bus().post(inspiral.message_new_checkpoint(self.pipeline, timestamp=now().ns()))
self.pipeline.get_bus().post(inspiral.message_new_checkpoint(self.pipeline, timestamp = inspiral.now().ns()))
if not self.pipeline.send_event(Gst.Event.new_eos()):
raise Exception("pipeline.send_event(EOS) returned failure")
except Exception as e:
......@@ -725,7 +720,7 @@ for output_file_number, (svd_bank_url_dict, output_url, ranking_stat_output_url,
@bottle.route("/bank.txt")
def get_filter_length_and_chirpmass(banks = banks):
bank = banks.values()[0][0] #FIXME maybe shouldn't just take the first ones
yield '%.14g %.4g %.4g' % (float(now()), bank.filter_length, bank.sngl_inspiral_table[0].mchirp)
yield '%.14g %.4g %.4g' % (float(inspiral.now()), bank.filter_length, bank.sngl_inspiral_table[0].mchirp)
#
......
......@@ -133,6 +133,10 @@ class LIGOLWContentHandler(ligolw.LIGOLWContentHandler):
#
def now():
return LIGOTimeGPS(lal.UTCToGPS(time.gmtime()))
def message_new_checkpoint(src, timestamp = None):
s = Gst.Structure.new_empty("CHECKPOINT")
message = Gst.Message.new_application(src, s)
......@@ -883,7 +887,13 @@ class Data(object):
del event.snr_time_series
def T050017_filename(self, description, extension):
start, end = segments.segmentlist(seglistdict.extent_all() for seglistdict in self.seglistdicts.values()).extent()
segs = segments.segmentlist(seglistdict.extent_all() for seglistdict in self.seglistdicts.values())
if segs:
start, end = segs.extent()
else:
# silence errors at start-up.
# FIXME: this is probably dumb. who cares.
start = end = now()
start, end = int(math.floor(start)), int(math.ceil(end))
return "%s-%s-%d-%d.%s" % ("".join(sorted(self.process.instruments)), description, start, end - start, extension)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment