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

Merge branch 'master' of ligo-vcs.phys.uwm.edu:/usr/local/git/gracedb

parents 6e92782a aa2e035a
No related branches found
No related tags found
No related merge requests found
......@@ -8,10 +8,13 @@ from django.conf import settings
import json
import logging
#from hashlib import sha1
#from ligo.overseer.client import send_to_overseer
#from multiprocessing import Process, Manager
# These imports can be fragile, so they should be brought in only
# if use of the LVAlert overseer is really intended.
if settings.USE_LVALERT_OVERSEER:
from hashlib import sha1
from ligo.overseer.client import send_to_overseer
from multiprocessing import Process, Manager
log = logging.getLogger('gracedb.alert')
......@@ -154,26 +157,33 @@ def issueXMPPAlert(event, location, alert_type="new", description="", serialized
msg = json.dumps(lva_data)
log.debug("issueXMPPAlert: writing message %s" % msg)
# manager = Manager()
if settings.USE_LVALERT_OVERSEER:
manager = Manager()
for server in settings.ALERT_XMPP_SERVERS:
port = settings.LVALERT_OVERSEER_PORTS[server]
for nodename in nodenames:
# # Calculate unique message_id and log
# message_id = sha1(nodename + msg).hexdigest()
# log.info("issueXMPPAlert: sending %s to node %s" % (message_id, nodename))
#
# rdict = manager.dict()
# msg_dict = {'node_name': nodename, 'message': msg, 'action': 'push'}
# p = Process(target=send_to_overseer, args=(msg_dict, rdict, log, True))
# p.start()
# p.join()
#
# if rdict.get('success', None):
# continue
if settings.USE_LVALERT_OVERSEER:
# Calculate unique message_id and log
message_id = sha1(nodename + msg).hexdigest()
log.info("issueXMPPAlert: sending %s to node %s on %s" % (message_id, nodename, server))
rdict = manager.dict()
msg_dict = {'node_name': nodename, 'message': msg, 'action': 'push'}
p = Process(target=send_to_overseer, args=(msg_dict, rdict, log, True, port))
p.start()
p.join()
if rdict.get('success', None):
continue
# If not success, we need to do this the old way.
log.info("issueXMPPAlert: failover to lvalert_send")
else:
# Not using LVAlert overseer, so just log the node and server
log.info("issueXMPPAlert: sending to node %s on %s" % (nodename, server))
# If not success, we need to do this the old way.
log.info("issueXMPPAlert: failover to lvalert_send")
null = open('/dev/null','w')
p = Popen(
["lvalert_send",
......
......@@ -37,9 +37,16 @@ ALERT_TEST_EMAIL_FROM = "Dev Test Alert <root@moe.phys.uwm.edu>"
ALERT_TEST_EMAIL_TO = [
"Branson Stephens <branson@gravity.phys.uwm.edu>",
]
ALERT_XMPP_SERVER = "jabber.phys.uwm.edu",
ALERT_XMPP_SERVERS = ["jabber.phys.uwm.edu",]
LVALERT_SEND_EXECUTABLE = '/home/branson/djangoenv/bin/lvalert_send'
ALERT_XMPP_SERVERS = ["lvalert-test.cgca.uwm.edu",]
LVALERT_SEND_EXECUTABLE = '/usr/bin/lvalert_send'
USE_LVALERT_OVERSEER = False
# For each lvalert server, a separate instance of the lvalert_overseer
# must be running and listening on a distinct port.
LVALERT_OVERSEER_PORTS = {
'lvalert-test.cgca.uwm.edu': 8001,
}
EMBB_MAIL_ADDRESS = 'branson@moe.phys.uwm.edu'
EMBB_SMTP_SERVER = 'localhost'
......
......@@ -30,6 +30,14 @@ ALERT_TEST_EMAIL_TO = [
ALERT_XMPP_SERVERS = ["lvalert.cgca.uwm.edu"]
LVALERT_SEND_EXECUTABLE = '/usr/bin/lvalert_send'
USE_LVALERT_OVERSEER = False
# For each lvalert server, a separate instance of the lvalert_overseer
# must be running and listening on a distinct port.
LVALERT_OVERSEER_PORTS = {
'lvalert.cgca.uwm.edu': 8000,
}
EMBB_MAIL_ADDRESS = 'embb@gracedb.ligo.org'
EMBB_SMTP_SERVER = 'localhost'
EMBB_MAIL_ADMINS = ['branson@gravity.phys.uwm.edu','roy.williams@ligo.org',]
......
......@@ -41,10 +41,17 @@ ALERT_TEST_EMAIL_TO = [
"Roy Williams <roy@caltech.edu>",
]
ALERT_XMPP_SERVER = 'jabber.phys.uwm.edu'
ALERT_XMPP_SERVERS = ['jabber.phys.uwm.edu',]
ALERT_XMPP_SERVERS = ['lvalert-test.cgca.uwm.edu',]
LVALERT_SEND_EXECUTABLE = '/usr/bin/lvalert_send'
# For each lvalert server, a separate instance of the lvalert_overseer
# must be running and listening on a distinct port.
LVALERT_OVERSEER_PORTS = {
'lvalert-test.cgca.uwm.edu': 8001,
}
USE_LVALERT_OVERSEER = False
EMBB_MAIL_ADDRESS = 'embb@embb-dev.ligo.caltech.edu'
EMBB_SMTP_SERVER = 'acrux.ligo.caltech.edu'
EMBB_MAIL_ADMINS = ['roy.williams@ligo.org',]
......
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