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

gstlal.lloidparts: print state vector transitions to stderr

parent 26e6e3c3
No related branches found
No related tags found
No related merge requests found
......@@ -208,7 +208,8 @@ def mkcontrolsnksrc(pipeline, rate, verbose = False, suffix = None, inj_seg_list
class get_state_vector(object):
# monitor state vector transitions, export via web
# interface
def __init__(self, elem):
def __init__(self, elem, verbose = False):
self.verbose = verbose
self.current_segment = "unknown"
self.segment_start = "unknown"
elem.connect("start", self.sighandler, "science")
......@@ -217,6 +218,8 @@ class get_state_vector(object):
def sighandler(self, elem, timestamp, segment_type):
self.current_segment = segment_type
self.segment_start = "%.9f" % (timestamp / 1e9)
if self.verbose:
print >>sys.stderr, "state transition: %s" % self.text()
def text(self):
return "%s @ %s\n" % (self.current_segment, self.segment_start)
......@@ -320,7 +323,9 @@ def mkLLOIDbasicsrc(pipeline, seekevent, instrument, detector, fake_data = None,
src = pipeparts.mkgate(pipeline, strain, threshold = 1, control = statevector)
# export state vector state
src.set_property("emit-signals", True)
bottle.route("/%s/current_segment.txt" % instrument)(get_state_vector(src).text)
# FIXME: let the state vector messages going to stderr be
# controled somehow
bottle.route("/%s/current_segment.txt" % instrument)(get_state_vector(src, verbose = True).text)
else:
src = pipeparts.mkaudioconvert(pipeline, src)
......
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