Skip to content
Snippets Groups Projects
Commit aa2e035a authored by Branson Craig Stephens's avatar Branson Craig Stephens
Browse files

Settings to disable use of the overseer and related imports.

parent 96025b93
No related branches found
No related tags found
No related merge requests found
......@@ -9,9 +9,12 @@ 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')
......@@ -150,27 +153,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 on %s" % (message_id, nodename, server))
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))
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")
null = open('/dev/null','w')
p = Popen(
["lvalert_send",
......
......@@ -40,6 +40,8 @@ ALERT_TEST_EMAIL_TO = [
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 = {
......
......@@ -30,6 +30,8 @@ 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 = {
......
......@@ -50,6 +50,8 @@ 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