Skip to content
Snippets Groups Projects
Commit 0530b595 authored by Alexander Pace's avatar Alexander Pace
Browse files

add svom pipeline

parent 88a98348
No related branches found
No related tags found
1 merge request!199add svom pipeline
Pipeline #601468 passed
......@@ -262,6 +262,7 @@ GRB_PIPELINES = [
'INTEGRAL',
'AGILE',
'CHIME',
'SVOM',
]
# List of pipelines that have been depreciated:
......
# -*- coding: utf-8 -*-
from django.db import migrations
from events.models import Pipeline, Search
# Creates initial search pipeline instances
# List of search pipeline names
NEW_PIPELINES = [
('SVOM', Pipeline.PIPELINE_TYPE_EXTERNAL),
]
def add_pipelines(apps, schema_editor):
Pipeline = apps.get_model('events', 'Pipeline')
Search = apps.get_model('events', 'Search')
# Create pipelines
for pipeline_name in NEW_PIPELINES:
pipeline, created = Pipeline.objects.get_or_create(name=pipeline_name[0])
pipeline.pipeline_type = pipeline_name[1]
pipeline.save()
def remove_pipelines(apps, schema_editor):
Pipeline = apps.get_model('events', 'Pipeline')
Search = apps.get_model('events', 'Search')
# Delete pipelines
for pipe in NEW_PIPELINES:
Pipeline.objects.filter(name=pipe[0]).delete()
class Migration(migrations.Migration):
dependencies = [
('events', '0089_alter_emobservation_group_and_more'),
]
operations = [
migrations.RunPython(add_pipelines, remove_pipelines),
]
......@@ -346,7 +346,8 @@ def handle_uploaded_data(event, datafilename,
comment=comment)
log.save()
elif pipeline in ['Swift', 'Fermi', 'SNEWS', 'INTEGRAL','AGILE', 'CHIME']:
elif pipeline in ['Swift', 'Fermi', 'SNEWS', 'INTEGRAL',
'AGILE', 'CHIME', 'SVOM']:
# Get the event time from the VOEvent file
error = None
populateGrbEventFromVOEventFile(datafilename, event)
......@@ -725,8 +726,16 @@ def populateGrbEventFromVOEventFile(filename, event):
# Fermi uses Trig_Dur or Data_Integ, while Swift uses Integ_Time
# One or the other may be present, but not both
VOEvent_params = vp.convenience.get_toplevel_params(v)
# Also grab parameters from embedded group if there, needed for SVOM
Svom_ident = vp.convenience.get_grouped_params(v).get('Svom_Identifiers')
Svom_detect = vp.convenience.get_grouped_params(v).get('Detection_Info')
if Svom_ident is not None:
VOEvent_params.update(Svom_ident)
if Svom_detect is not None:
VOEvent_params.update(Svom_detect)
trig_dur_params = ["Trig_Dur", "Trans_Duration", "Data_Integ",
"Integ_Time", "Trig_Timescale"]
"Integ_Time", "Trig_Timescale", "Timescale"]
trigger_duration = None
for param in trig_dur_params:
if (param in VOEvent_params):
......@@ -742,7 +751,8 @@ def populateGrbEventFromVOEventFile(filename, event):
# try to find a trigger_id value
trigger_id = None
trigger_id_params = ['TrigID', 'Trans_Num', 'EventID']
trigger_id_params = ['TrigID', 'Trans_Num', 'EventID',
'Burst_Id']
for param in trigger_id_params:
if (param in VOEvent_params):
trigger_id = VOEvent_params.get(param).get('value')
......
......@@ -56,7 +56,8 @@ def _createEventFromForm(request, form):
# Create Event
if pipeline.name in ['gstlal', 'spiir', 'MBTAOnline', 'MBTA', 'pycbc', 'PyGRB']:
event = CoincInspiralEvent()
elif pipeline.name in ['Fermi', 'Swift', 'SNEWS','INTEGRAL','AGILE', 'CHIME']:
elif pipeline.name in ['Fermi', 'Swift', 'SNEWS','INTEGRAL','AGILE', 'CHIME',
'SVOM']:
event = GrbEvent()
elif pipeline.name in ['CWB', 'CWB2G']:
event = MultiBurstEvent()
......
# -*- coding: utf-8 -*-
# supports: https://git.ligo.org/computing/gracedb/server/-/issues/338
from django.db import migrations
# Creates UserObjectPermission objects which allow specific users
# to add events for pipelines. Based on current production database
# content (27 October 2017)
# List of pipeline names and lists of usernames who should
# be allowed to add events for them
PP_LIST = [
{
'pipeline': 'SVOM',
'usernames': [
'brandon.piotrzkowski@ligo.org',
'naresh.adhikari@ligo.org',
'rachel.hamburg@ligo.org',
'emfollow',
]
},
]
def add_permissions(apps, schema_editor):
User = apps.get_model('auth', 'User')
Permission = apps.get_model('auth', 'Permission')
UserObjectPermission = apps.get_model('guardian', 'UserObjectPermission')
Pipeline = apps.get_model('events', 'Pipeline')
ContentType = apps.get_model('contenttypes', 'ContentType')
perm = Permission.objects.get(codename='populate_pipeline')
ctype = ContentType.objects.get_for_model(Pipeline)
for pp_dict in PP_LIST:
pipeline, created = Pipeline.objects.get_or_create(name=pp_dict['pipeline'])
# Loop over users
for username in pp_dict['usernames']:
# Robot users should have been already created by ligoauth 0003,
# but we have to create human user accounts here
user, _ = User.objects.get_or_create(username=username)
# Create UserObjectPermission
uop, uop_created = UserObjectPermission.objects.get_or_create(
user=user, permission=perm, content_type=ctype,
object_pk=pipeline.id)
def remove_permissions(apps, schema_editor):
pass
class Migration(migrations.Migration):
dependencies = [
('guardian', '0020_populate_aframe_uploaders'),
('events', '0090_add_svom_pipeline'),
]
operations = [
migrations.RunPython(add_permissions, remove_permissions),
]
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