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

lvalert_helper: add upload_xmldoc

parent 92833243
No related branches found
No related tags found
No related merge requests found
......@@ -86,3 +86,13 @@ def upload_file(gracedb_client, graceid, filename, log_message = "A file", tagna
response = gracedb_client.writeLog(graceid, log_message, filename = filename, filecontents = io.FileIO(filename).readall(), tagname = tagname)
if response.status != httplib.CREATED:
raise Exception("upload of \"%s\" for %s failed: %s" % (filename, graceid, response["error"]))
def upload_xmldoc(gracedb_client, graceid, filename, xmldoc, log_message = "A file", tagname = None):
logging.info("uploading \"%s\" for %s" % (filename, graceid))
output = StringIO.StringIO()
ligolw_utils.write_fileobj(xmldoc, output, gz = filename.endswith(".gz"))
response = gracedb_client.writeLog(graceid, log_message, filename = filename, filecontents = output.getvalue(), tagname = tagname)
output.close()
if response.status != httplib.CREATED:
raise Exception("upload of \"%s\" for %s failed: %s" % (filename, graceid, response["error"]))
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