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
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
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
IGWN Computing and Software
GraceDB
GraceDB Server
Commits
2cd7586e
Commit
2cd7586e
authored
9 years ago
by
Branson Stephens
Committed by
Branson Craig Stephens
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Aligned buildVOEvent with Scott's requirements.
parent
f87b4279
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/buildVOEvent.py
+45
-3
45 additions, 3 deletions
gracedb/buildVOEvent.py
with
45 additions
and
3 deletions
gracedb/buildVOEvent.py
+
45
−
3
View file @
2cd7586e
...
...
@@ -41,6 +41,12 @@ def get_url(request, graceid, view_name, file_name=None):
VOEVENT_TYPE_DICT
=
dict
(
GraceDBVOEvent
.
VOEVENT_TYPE_CHOICES
)
def
get_voevent_type
(
short_name
):
for
t
in
GraceDBVOEvent
.
VOEVENT_TYPE_CHOICES
:
if
short_name
in
t
:
return
t
[
1
]
return
None
def
buildVOEvent
(
event
,
serial_number
,
voevent_type
,
request
=
None
,
skymap_filename
=
None
,
skymap_type
=
None
,
skymap_image_filename
=
None
,
internal
=
1
):
...
...
@@ -60,7 +66,22 @@ def buildVOEvent(event, serial_number, voevent_type, request=None, skymap_filena
objid
=
event
.
graceid
()
# Now build the IVORN.
event_id
=
"
%s-%d-%s
"
%
(
objid
,
serial_number
,
voevent_type
.
capitalize
())
# XXX This will have the string '-Retraction' appended if it is a retraction,
# and the voevent_type will refer to the type of the *previous* voevent.
# This is highly objectionable.
type_string
=
voevent_type
.
capitalize
()
if
voevent_type
==
'
retraction
'
:
try
:
last_voevent
=
event
.
voevent_set
.
order_by
(
'
-N
'
)[
1
]
type_string
=
get_voevent_type
(
last_voevent
.
voevent_type
).
capitalize
()
type_string
+=
'
-Retraction
'
except
:
# XXX Somehow failed to get the previous VOEvent. This is a bad situation.
# But we can't just error out, because sending out the retraction is pretty
# important.
type_string
=
'
Preliminary-Retraction
'
event_id
=
"
%s-%d-%s
"
%
(
objid
,
serial_number
,
type_string
)
ivorn
=
settings
.
SKYALERT_IVORN_PATTERN
%
event_id
############ VOEvent header ############################
...
...
@@ -138,14 +159,35 @@ def buildVOEvent(event, serial_number, voevent_type, request=None, skymap_filena
value
=
objid
,
Description
=
[
"
Identifier in GraceDB
"
]))
# The alert type
# XXX if voevent_type == 'retraction' the AlertType will be the type of the
# last VOEvent sent out. This is highly objectionable.
alert_type
=
voevent_type
if
voevent_type
==
'
retraction
'
:
try
:
last_voevent
=
event
.
voevent_set
.
order_by
(
'
-N
'
)[
1
]
alert_type
=
get_voevent_type
(
last_voevent
.
voevent_type
)
except
:
# XXX We have failed to obtain the last voevent for some reason, so
# we don't know what the alert type should be. Let's just set it to
# preliminary, since we need to try not to error out of sending the
# retraction
alert_type
=
'
preliminary
'
w
.
add_Param
(
Param
(
name
=
"
AlertType
"
,
dataType
=
"
string
"
,
ucd
=
"
meta.version
"
,
unit
=
""
,
value
=
voeven
t_type
.
capitalize
(),
value
=
aler
t_type
.
capitalize
(),
Description
=
[
"
VOEvent alert type
"
]))
w
.
add_Param
(
Param
(
name
=
"
Retraction
"
,
dataType
=
"
string
"
,
ucd
=
"
meta.code
"
,
unit
=
""
,
value
=
"
true
"
if
voevent_type
==
'
retraction
'
else
"
false
"
,
Description
=
[
"
Set to true if the event is retracted.
"
]))
# Shib protected event page
w
.
add_Param
(
Param
(
name
=
"
EventPage
"
,
ucd
=
"
meta.ref.url
"
,
...
...
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