From 0ff0464fd2e5b3074ff6e12a975366c2e34e6acf Mon Sep 17 00:00:00 2001 From: Cody Messick <cody.messick@ligo.org> Date: Mon, 25 Feb 2019 10:26:45 -0800 Subject: [PATCH] inspiral.py: write coinc files to disk after uploading to gracedb --- gstlal-inspiral/python/inspiral.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gstlal-inspiral/python/inspiral.py b/gstlal-inspiral/python/inspiral.py index 76c5624972..43fe581e70 100644 --- a/gstlal-inspiral/python/inspiral.py +++ b/gstlal-inspiral/python/inspiral.py @@ -59,6 +59,7 @@ import sys import time import httplib import tempfile +import os from glue import iterutils from ligo.lw import ligolw @@ -685,7 +686,6 @@ class GracedBWrapper(object): # serialize to XML ligolw_utils.write_fileobj(xmldoc, message, gz = False) - xmldoc.unlink() # FIXME: make this optional from command line? if True: for attempt in range(1, self.retries + 1): @@ -708,6 +708,14 @@ class GracedBWrapper(object): with open(filename, "w") as f: f.write(message.getvalue()) message.close() + try: + os.mkdir("gracedb_uploads") + except OSError: + pass + with open(os.path.join("gracedb_uploads", filename), "w") as fileobj: + ligolw_utils.write_fileobj(xmldoc, fileobj, gz = False) + + xmldoc.unlink() # # upload PSDs and ranking statistic data -- GitLab