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
a83ed3e2
Commit
a83ed3e2
authored
8 years ago
by
Tanner Prestegard
Committed by
Alexander Pace
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
separated phone alerts from e-mail alerts for event creation
parent
ab3fb1f4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gracedb/alert.py
+25
-6
25 additions, 6 deletions
gracedb/alert.py
with
25 additions
and
6 deletions
gracedb/alert.py
+
25
−
6
View file @
a83ed3e2
...
...
@@ -119,6 +119,7 @@ def make_twilio_calls(event, twilio_recips, alert_type, **kwargs):
def
issueAlert
(
event
,
location
,
event_url
,
serialized_object
=
None
):
issueXMPPAlert
(
event
,
location
,
serialized_object
=
serialized_object
)
issueEmailAlert
(
event
,
event_url
)
issuePhoneAlert
(
event
)
def
indent
(
nindent
,
text
):
return
"
\n
"
.
join
([(
nindent
*
'
'
)
+
line
for
line
in
text
.
split
(
'
\n
'
)])
...
...
@@ -201,7 +202,8 @@ def issueAlertForLabel(event, label, doxmpp, serialized_event=None, event_url=No
email
.
send
()
# Make phone calls.
make_twilio_calls
(
event
,
phoneRecips
,
"
label
"
,
label
=
label
)
if
phoneRecips
:
make_twilio_calls
(
event
,
phoneRecips
,
"
label
"
,
label
=
label
)
def
issueEmailAlert
(
event
,
event_url
):
...
...
@@ -216,7 +218,6 @@ def issueEmailAlert(event, event_url):
fromaddress
=
settings
.
ALERT_TEST_EMAIL_FROM
toaddresses
=
settings
.
ALERT_TEST_EMAIL_TO
bccaddresses
=
[]
phoneRecips
=
[]
else
:
fromaddress
=
settings
.
ALERT_EMAIL_FROM
toaddresses
=
settings
.
ALERT_EMAIL_TO
...
...
@@ -226,7 +227,6 @@ def issueEmailAlert(event, event_url):
# See: https://bugs.ligo.org/redmine/issues/2185
#bccaddresses = settings.ALERT_EMAIL_BCC
bccaddresses
=
[]
phoneRecips
=
[]
pipeline
=
event
.
pipeline
triggers
=
pipeline
.
trigger_set
.
filter
(
labels
=
None
)
for
trigger
in
triggers
:
...
...
@@ -235,8 +235,6 @@ def issueEmailAlert(event, event_url):
or
not
trigger
.
farThresh
):
if
recip
.
email
:
bccaddresses
.
append
(
recip
.
email
)
if
recip
.
phone
:
phoneRecips
.
append
(
recip
)
subject
=
"
[gracedb] %s event. ID: %s
"
%
(
event
.
pipeline
.
name
,
event
.
graceid
())
message
=
"""
...
...
@@ -261,8 +259,29 @@ Event Summary:
email
=
EmailMessage
(
subject
,
message
,
fromaddress
,
toaddresses
,
bccaddresses
)
email
.
send
()
def
issuePhoneAlert
(
event
):
# The right way of doing this is to make the email alerts filter-able
# by search. But this is a low priority dev task. For now, we simply
# short-circuit in case this is an MDC event.
if
event
.
search
and
event
.
search
.
name
==
'
MDC
'
:
return
# Gather Recipients
phoneRecips
=
[]
if
event
.
group
.
name
!=
'
Test
'
:
pipeline
=
event
.
pipeline
triggers
=
pipeline
.
trigger_set
.
filter
(
labels
=
None
)
for
trigger
in
triggers
:
for
recip
in
trigger
.
contacts
.
all
():
if
((
event
.
far
and
event
.
far
<
trigger
.
farThresh
)
or
not
trigger
.
farThresh
):
if
recip
.
phone
:
phoneRecips
.
append
(
recip
)
# Make phone calls.
make_twilio_calls
(
event
,
phoneRecips
,
"
create
"
)
if
phoneRecips
:
make_twilio_calls
(
event
,
phoneRecips
,
"
create
"
)
def
issueXMPPAlert
(
event
,
location
,
alert_type
=
"
new
"
,
description
=
""
,
serialized_object
=
None
):
...
...
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