Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
GraceDB Server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michael William Coughlin
GraceDB Server
Commits
2bc67ce3
Commit
2bc67ce3
authored
15 years ago
by
Brian Moe
Browse files
Options
Downloads
Patches
Plain Diff
Separate Test events alerts email list / ping give host name
parent
2cf5e184
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
gracedb/alert.py
+11
-73
11 additions, 73 deletions
gracedb/alert.py
gracedb/views.py
+3
-1
3 additions, 1 deletion
gracedb/views.py
settings.py
+9
-2
9 additions, 2 deletions
settings.py
settings_dev.py
+7
-2
7 additions, 2 deletions
settings_dev.py
with
30 additions
and
78 deletions
gracedb/alert.py
+
11
−
73
View file @
2bc67ce3
...
@@ -14,6 +14,12 @@ def issueAlert(event, location):
...
@@ -14,6 +14,12 @@ def issueAlert(event, location):
issueEmailAlert
(
event
,
location
)
issueEmailAlert
(
event
,
location
)
def
issueEmailAlert
(
event
,
location
):
def
issueEmailAlert
(
event
,
location
):
if
event
.
group
.
name
==
'
Test
'
:
fromaddress
=
settings
.
ALERT_TEST_EMAIL_FROM
toaddress
=
settings
.
ALERT_TEST_EMAIL_TO
else
:
fromaddress
=
settings
.
ALERT_EMAIL_FROM
toaddress
=
settings
.
ALERT_EMAIL_TO
subject
=
"
[gracedb] %s event. ID: %s
"
%
(
event
.
get_analysisType_display
(),
event
.
graceid
())
subject
=
"
[gracedb] %s event. ID: %s
"
%
(
event
.
get_analysisType_display
(),
event
.
graceid
())
message
=
"""
message
=
"""
New Event
New Event
...
@@ -33,23 +39,20 @@ def issueEmailAlert(event, location):
...
@@ -33,23 +39,20 @@ def issueEmailAlert(event, location):
event
.
wikiurl
(),
event
.
wikiurl
(),
event
.
submitter
.
name
,
event
.
submitter
.
name
,
location
)
location
)
fromaddress
=
settings
.
ALERT_EMAIL_FROM
send_mail
(
subject
,
message
,
fromaddress
,
toaddress
)
to
=
settings
.
ALERT_EMAIL_TO
send_mail
(
subject
,
message
,
fromaddress
,
to
)
def
issueXMPPAlert
(
event
,
location
):
def
issueXMPPAlert
(
event
,
location
):
# XXX awful!
# XXX awful!
# Need a good way to know which things to send out to lvalert.
# Currently, only Test/* and CBC/MBTAOnline get alerts.
if
event
.
analysisType
!=
'
MBTA
'
and
event
.
group
.
name
!=
'
Test
'
:
if
event
.
analysisType
!=
'
MBTA
'
and
event
.
group
.
name
!=
'
Test
'
:
return
return
env
=
{}
env
=
{}
env
[
"
PYTHONPATH
"
]
=
"
:
"
.
join
(
sys
.
path
)
env
[
"
PYTHONPATH
"
]
=
"
:
"
.
join
(
sys
.
path
)
if
event
.
analysisType
==
'
MBTA
'
and
event
.
group
.
name
==
'
CBC
'
:
nodename
=
"
%s_%s
"
%
(
event
.
group
.
name
,
event
.
get_analysisType_display
())
nodename
=
"
cbc_mbta_online
"
nodename
=
nodename
.
lower
()
else
:
nodename
=
"
%s_%s
"
%
(
event
.
group
.
name
,
event
.
get_analysisType_display
())
nodename
=
nodename
.
lower
()
null
=
open
(
'
/dev/null
'
,
'
w
'
)
null
=
open
(
'
/dev/null
'
,
'
w
'
)
p
=
Popen
(
p
=
Popen
(
...
@@ -74,22 +77,6 @@ def issueXMPPAlert(event, location):
...
@@ -74,22 +77,6 @@ def issueXMPPAlert(event, location):
else
:
else
:
break
break
#def issueAlertX(event, location):
# username = "gracedb"
# server = "lvalert.phys.uwm.edu"
# resource = "sender"
# password = "w4k3upal1ve"
# node = "cbc_mbta_online"
# voevent = createPayload(event.graceid(), location)
#
# myjid=JID(username+"@"+server+"/"+resource)
# recpt=JID("pubsub."+server)
#
# s=MyClient(jid=myjid, password=password, recpt=recpt)
# s.connect()
# s.send_myevent(voevent, node)
# s.loop(1)
def
createPayload
(
uid
,
filename
):
def
createPayload
(
uid
,
filename
):
template
=
"""
<?xml version=
'
1.0
'
encoding=
'
utf-8
'
?>
template
=
"""
<?xml version=
'
1.0
'
encoding=
'
utf-8
'
?>
<!DOCTYPE LIGO_LW SYSTEM
"
http://ldas-sw.ligo.caltech.edu/doc/ligolwAPI/html/ligolw_dtd.txt
"
>
<!DOCTYPE LIGO_LW SYSTEM
"
http://ldas-sw.ligo.caltech.edu/doc/ligolwAPI/html/ligolw_dtd.txt
"
>
...
@@ -105,52 +92,3 @@ def createPayload (uid, filename):
...
@@ -105,52 +92,3 @@ def createPayload (uid, filename):
"""
"""
return
template
%
{
'
uid
'
:
uid
,
'
filename
'
:
filename
}
return
template
%
{
'
uid
'
:
uid
,
'
filename
'
:
filename
}
## pubsub import must come first because it overloads part of the
## StanzaProcessor class
#from glue.lvalert import pubsub
#
#from pyxmpp.all import JID, TLSSettings
#from pyxmpp.jabber.all import Client
#
#
#class MyClient(Client):
# def __init__(self, jid, password, recpt):
# # if bare JID is provided add a resource -- it is required
# if not jid.resource:
# jid=JID(jid.node, jid.domain, "sender")
# self.myrecpt = recpt
#
# # we require a TLS connection
# t=TLSSettings(require=True,verify_peer=False)
#
# # setup client with provided connection information
# # and identity data
# Client.__init__(self, jid, password, \
# auth_methods=["sasl:GSSAPI","sasl:PLAIN"], tls_settings=t)
#
# def stream_state_changed(self,state,arg):
# """This one is called when the state of stream connecting the component
# to a server changes. This will usually be used to let the user
# know what is going on."""
# pass
#
# def session_started(self):
# self.stream.set_response_handlers(self.pspl, \
# self.pspl.generic_result,self.pspl.create_error,\
# self.pspl.create_timeout)
# self.stream.send(self.pspl)
#
# def idle(self):
# if self.stream and self.session_established:
# self.disconnect()
# time.sleep(2)
#
# def post_disconnect(self):
# raise Disconnected
#
# def send_myevent(self, voevent, node):
# self.pspl=pubsub.PubSub(from_jid = self.jid, to_jid = self.myrecpt, stream = self, stanza_type="get")
# self.pspl.publish(voevent,node)
# vi: sts=4 et sw=4
This diff is collapsed.
Click to expand it.
gracedb/views.py
+
3
−
1
View file @
2bc67ce3
...
@@ -3,6 +3,7 @@ from django.http import HttpResponse, HttpResponseRedirect, HttpResponseNotFound
...
@@ -3,6 +3,7 @@ from django.http import HttpResponse, HttpResponseRedirect, HttpResponseNotFound
from
django.template
import
RequestContext
from
django.template
import
RequestContext
from
django.core.urlresolvers
import
reverse
,
get_script_prefix
from
django.core.urlresolvers
import
reverse
,
get_script_prefix
from
django.shortcuts
import
render_to_response
from
django.shortcuts
import
render_to_response
from
django.contrib.sites.models
import
Site
from
django.views.generic.list_detail
import
object_detail
,
object_list
from
django.views.generic.list_detail
import
object_detail
,
object_list
...
@@ -161,7 +162,8 @@ def log(request):
...
@@ -161,7 +162,8 @@ def log(request):
return
response
return
response
def
ping
(
request
):
def
ping
(
request
):
ack
=
request
.
POST
.
get
(
'
ack
'
,
None
)
or
request
.
GET
.
get
(
'
ack
'
,
'
ACK
'
)
ack
=
"
(%s)
"
%
Site
.
objects
.
get_current
()
ack
+=
request
.
POST
.
get
(
'
ack
'
,
None
)
or
request
.
GET
.
get
(
'
ack
'
,
'
ACK
'
)
response
=
HttpResponse
(
mimetype
=
'
text/plain
'
)
response
=
HttpResponse
(
mimetype
=
'
text/plain
'
)
response
.
write
(
ack
)
response
.
write
(
ack
)
response
[
'
Content-length
'
]
=
len
(
ack
)
response
[
'
Content-length
'
]
=
len
(
ack
)
...
...
This diff is collapsed.
Click to expand it.
settings.py
+
9
−
2
View file @
2bc67ce3
...
@@ -4,19 +4,26 @@ DEBUG = True
...
@@ -4,19 +4,26 @@ DEBUG = True
TEMPLATE_DEBUG
=
DEBUG
TEMPLATE_DEBUG
=
DEBUG
ADMINS
=
(
ADMINS
=
(
# ('Your Name', 'your_email@domain.com
'),
(
'
Brian Moe
'
,
'
bmoe@gravity.phys.uwm.edu
'
),
)
)
MANAGERS
=
ADMINS
MANAGERS
=
ADMINS
ALERT_EMAIL_FROM
=
"
root@archie.phys.uwm.edu
"
ALERT_EMAIL_FROM
=
"
Gracedb Alert <
root@archie.phys.uwm.edu
>
"
ALERT_EMAIL_TO
=
[
"
patrick@gravity.phys.uwm.edu
"
,
ALERT_EMAIL_TO
=
[
"
patrick@gravity.phys.uwm.edu
"
,
"
larry@gravity.phys.uwm.edu
"
,
"
larry@gravity.phys.uwm.edu
"
,
"
bmoe@gravity.phys.uwm.edu
"
,
"
bmoe@gravity.phys.uwm.edu
"
,
'
Frederique Marion <marionf@lapp.in2p3.fr>
'
,
'
Frederique Marion <marionf@lapp.in2p3.fr>
'
,
"
Benoit MOURS <mours@lapp.in2p3.fr>
"
,
"
Benoit MOURS <mours@lapp.in2p3.fr>
"
,
"
Jonah Kanner <jkanner@umd.edu>
"
,
]
]
ALERT_TEST_EMAIL_FROM
=
"
Gracedb TEST Alert <root@archie.phys.uwm.edu>
"
ALERT_TEST_EMAIL_TO
=
[
"
patrick@gravity.phys.uwm.edu
"
,
"
larry@gravity.phys.uwm.edu
"
,
"
bmoe@gravity.phys.uwm.edu
"
,
]
DATABASE_ENGINE
=
'
mysql
'
DATABASE_ENGINE
=
'
mysql
'
DATABASE_NAME
=
'
gracedb
'
DATABASE_NAME
=
'
gracedb
'
DATABASE_USER
=
'
gracedb
'
DATABASE_USER
=
'
gracedb
'
...
...
This diff is collapsed.
Click to expand it.
settings_dev.py
+
7
−
2
View file @
2bc67ce3
...
@@ -4,17 +4,22 @@ DEBUG = True
...
@@ -4,17 +4,22 @@ DEBUG = True
TEMPLATE_DEBUG
=
DEBUG
TEMPLATE_DEBUG
=
DEBUG
ADMINS
=
(
ADMINS
=
(
# ('Your Name', 'your_email@domain.com
'),
(
'
Brian Moe
'
,
'
bmoe@gravity.phys.uwm.edu
'
),
)
)
MANAGERS
=
ADMINS
MANAGERS
=
ADMINS
ALERT_EMAIL_FROM
=
"
bmoe@
uwm.edu
"
ALERT_EMAIL_FROM
=
"
Dev Alert <root@moe.phys.
uwm.edu
>
"
ALERT_EMAIL_TO
=
[
ALERT_EMAIL_TO
=
[
"
Brian Moe <bmoe@gravity.phys.uwm.edu>
"
,
"
Brian Moe <bmoe@gravity.phys.uwm.edu>
"
,
"
bmoe@uwm.edu
"
,
"
bmoe@uwm.edu
"
,
]
]
ALERT_TEST_EMAIL_FROM
=
"
Dev Test Alert <root@moe.phys.uwm.edu>
"
ALERT_TEST_EMAIL_TO
=
[
"
Brian Moe <bmoe@gravity.phys.uwm.edu>
"
,
]
DATABASE_ENGINE
=
'
mysql
'
DATABASE_ENGINE
=
'
mysql
'
DATABASE_NAME
=
'
gracedb
'
DATABASE_NAME
=
'
gracedb
'
DATABASE_USER
=
'
gracedb
'
DATABASE_USER
=
'
gracedb
'
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment