Gitlab will migrate to a new storage backend starting 0300 UTC on 2020-04-04. We do not anticipate a maintenance window for this migration. Performance may be impacted over the weekend. Thanks for your patience.

Commit 7119da4d authored by Tanner Prestegard's avatar Tanner Prestegard Committed by GraceDB

Create data directories for HardwareInjections

Some additional code cleanup, as well.
parent a4385973
Pipeline #44125 passed with stages
in 29 seconds
# -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-01-09 17:43
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('events', '0029_create_bbh_search'),
]
operations = [
migrations.AlterField(
model_name='siminspiralevent',
name='destination_channel',
field=models.CharField(blank=True, default=b'', max_length=50, null=True),
),
migrations.AlterField(
model_name='siminspiralevent',
name='source_channel',
field=models.CharField(blank=True, default=b'', max_length=50, null=True),
),
]
......@@ -843,8 +843,8 @@ class SimInspiralEvent(Event):
eff_dist_t = models.FloatField(null=True)
eff_dist_v = models.FloatField(null=True)
# Additional desired attributes that are not in the SimInspiral table
source_channel = models.CharField(max_length=50, blank=True, default="")
destination_channel = models.CharField(max_length=50, blank=True, default="")
source_channel = models.CharField(max_length=50, blank=True, default="", null=True)
destination_channel = models.CharField(max_length=50, blank=True, default="", null=True)
@classmethod
def field_names(cls):
......
......@@ -78,7 +78,8 @@ def _createEventFromForm(request, form):
if pipeline.name in ['HardwareInjection',]:
event.source_channel = request.POST.get('source_channel', None)
event.destination_channel = request.POST.get('destination_channel', None)
event.instruments = request.POST.get('instrument', None)
event.instruments = request.POST.get('instrument',
request.POST.get('instruments', None))
# ARGH. We don't get a graceid until we save,
# but we don't know in advance if we can actually
......@@ -99,31 +100,23 @@ def _createEventFromForm(request, form):
event.refresh_perms()
# Create data directory/directories
# Save uploaded file.
# Write the event data file to disk.
# But there are way too many hardware injections to save them to disk
eventDir = event.datadir
os.makedirs(eventDir)
# Write the event data file to disk.
f = request.FILES['eventFile']
if pipeline.name not in ['HardwareInjection',]:
eventDir = event.datadir
os.makedirs( eventDir )
uploadDestination = os.path.join(eventDir, f.name)
fdest = VersionedFile(uploadDestination, 'w')
for chunk in f.chunks():
fdest.write(chunk)
fdest.close()
file_contents = None
else:
uploadDestination = None
file_contents = f.read()
# Create WIKI page
uploadDestination = os.path.join(eventDir, f.name)
fdest = VersionedFile(uploadDestination, 'w')
for chunk in f.chunks():
fdest.write(chunk)
fdest.close()
file_contents = None
# Extract Info from uploaded data
# Temp (ha!) hack to deal with
# out of band data from Omega to LUMIN.
try:
temp_data_loc, translator_warnings = handle_uploaded_data(event, uploadDestination,
temp_data_loc, translator_warnings = handle_uploaded_data(event, uploadDestination,
file_contents = file_contents)
warnings += translator_warnings
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment