Skip to content
Snippets Groups Projects
Commit 023bf32a authored by Rachael Huxford's avatar Rachael Huxford
Browse files

Minor patch to change creation of temporary files, and creation of output...

Minor patch to change creation of temporary files, and creation of output directory if it does not exist
parent 58357a72
No related branches found
No related tags found
1 merge request!554Injections Streamer to o4a online
Pipeline #574146 passed with warnings
......@@ -148,7 +148,7 @@ Gst.init(None)
mainloop = GObject.MainLoop()
pipeline = Gst.Pipeline(name="gstlal_ll_inj_stream")
handler = simplehandler.Handler(mainloop, pipeline)
simplehandler.OneTimeSignalHandler(pipeline)
#
# Parse Input Options
......@@ -178,8 +178,11 @@ for smd in options.shared_memory_partition:
# Output Frame Options
output_dir_dict = {}
for out_dir in options.output_dir:
output_dir_dict[out_dir.split('=')[0]] = out_dir.split('=')[1]
for out_dir_by_ifo in options.output_dir:
outdir = out_dir_by_ifo.split('=')[1]
if not os.path.exists(outdir):
os.mkdir(outdir)
output_dir_dict[out_dir_by_ifo.split('=')[0]] = outdir
frame_type_dict = {}
for ftype in options.frame_type:
......@@ -212,11 +215,13 @@ end = LIGOTimeGPS(int(options.gps_end_time), 0)
if end < now:
raise ValueError("--gps-end-time must be greater than the current gps time. Now: %s, Supplied gps-end-time:%s"%(now, end))
#create new cache
#create new cache dropping older frames
now_to_end_seg = segments.segment((now, end))
new_cache = [c for c in cache_entries if now_to_end_seg.intersects(c.segment)]
print(len(new_cache))
this_inj_frame_cache = 'temp_caches/%s_inj.cache'%now
tmp_dir = os.path.join(os.getenv("TMPDIR"), 'inj_stream_tmp_cache')
if not os.path.exists(tmp_dir):
os.mkdir(tmp_dir)
this_inj_frame_cache = os.path.join(tmp_dir, 'inj_stream_tmp.cache')
with open(this_inj_frame_cache,"w") as f:
f.write("\n".join(["%s" % c for c in new_cache]))
......
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