Skip to content
Snippets Groups Projects
Commit c61dd4a1 authored by Brian Moe's avatar Brian Moe
Browse files

Quick changes for SkyAlert submission.

parent ff3fdb85
No related branches found
No related tags found
No related merge requests found
......@@ -178,6 +178,7 @@ def submitToSkyalert(gevent, validate_only=False):
# the server that will handle the submit request
url = "http://skyalert.org/submit/"
url = "https://betelgeuse.ligo.caltech.edu:8000/submit/"
url = "http://betelgeuse.ligo.caltech.edu/submit/"
# choose 'dryrun' for validation and 'author' for authoring
dict['checker'] = 'dryrun'
......@@ -190,11 +191,11 @@ def submitToSkyalert(gevent, validate_only=False):
dict['checker'] = 'author'
# Skyalert username and password
dict['username'] = 'brian'
dict['password'] = 'man8men.'
dict['username'] = 'system'
dict['password'] = 'OPV537'
# This is the short name for the stream, must match credentials and event!
dict['streamName'] = 'gracedb'
dict['streamName'] = 'LIGO'
# Should alerts be run once the event is ingested?
dict['doRules'] = 'on'
......
......@@ -90,18 +90,22 @@ def skyalert(request, graceid):
"Event: %s\nException: %s\n" % (graceid, e),
fail_silently=True)
flashmessage = None
if skyalert_response.find("Success") >= 0:
urlpat = re.compile('https://[^ ]*')
urlpat = re.compile('https?://[^ ]*')
match = urlpat.search(skyalert_response)
if match:
message = "Submitted to Skyalert: %s" % match.group()
url = match.group()
flashmessage = 'Submitted to Skyalert: %s' % url
message = 'Submitted to Skyalert: <a href="%s">%s</a>' % (url,url)
else:
message = "SkyAlert submission problem. Cannot parse SkyAlert response."
# XXX umm. don't we want to know if this email fails silently?
mail_admins("SkyAlert response parsing problem",
"Event: %s\nSkyAlert Response: %s\n" % (graceid, skyalert_response),
fail_silently=True)
elif skyalert_response.find('already') >= 0:
elif (skyalert_response.find('already') >= 0) or (skyalert_response.find('Duplicate') >= 0):
message = "Event already submitted to SkyAlert"
createLogEntry = False
elif skyalert_response:
......@@ -110,7 +114,7 @@ def skyalert(request, graceid):
"Event: %s\nSkyAlert Response: %s\n" % (graceid, skyalert_response),
fail_silently=True)
request.session['flash_msg'] = message
request.session['flash_msg'] = flashmessage or message
if createLogEntry:
logentry = EventLog(event=event, issuer=request.ligouser, comment=message)
......
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