Skip to content
Snippets Groups Projects
Commit 22a16f79 authored by Mario Raciti's avatar Mario Raciti
Browse files

TMSS-474: Update cycle start and stop dates to actual values

parent a819f30a
No related branches found
No related tags found
1 merge request!386Resolve TMSS-474
......@@ -133,11 +133,55 @@ def populate_test_data():
def populate_cycles(apps, schema_editor):
for nr in range(0, 18):
cycles_info = [] # TODO: For debugging purposes, remove it when done.
# Cycle 0 deviates from any patterns
cycle = models.Cycle.objects.create(name="Cycle 00",
description="Lofar Cycle 0",
start=datetime(2013, 2, 11, 0, 0, 0, 0,
tzinfo=timezone.utc),
stop=datetime(2013, 11, 14, 0, 0, 0, 0,
tzinfo=timezone.utc))
models.CycleQuota.objects.bulk_create([models.CycleQuota(cycle=cycle,
resource_type=ResourceType.objects.get(
name="observing_time"),
value=0.8 * cycle.duration.total_seconds()),
# rough guess. 80% of total time available for observing
models.CycleQuota(cycle=cycle,
resource_type=ResourceType.objects.get(
name="cep_processing_time"),
value=0.8 * cycle.duration.total_seconds()),
models.CycleQuota(cycle=cycle,
resource_type=ResourceType.objects.get(name="lta_storage"),
value=0), # needs to be filled in by user (SOS)
models.CycleQuota(cycle=cycle,
resource_type=ResourceType.objects.get(
name="support_time"),
value=0), # needs to be filled in by user (SOS)
models.CycleQuota(cycle=cycle,
resource_type=ResourceType.objects.get(
name="observing_time_commissioning"),
value=0.05 * cycle.duration.total_seconds()),
# rough guess. 5% of total time available for observing
models.CycleQuota(cycle=cycle,
resource_type=ResourceType.objects.get(
name="observing_time_prio_a"),
value=0), # needs to be filled in by user (SOS)
models.CycleQuota(cycle=cycle,
resource_type=ResourceType.objects.get(
name="observing_time_prio_b"),
value=0) # needs to be filled in by user (SOS)
])
cycles_info.append((cycle.name, cycle.start, cycle.stop))
# Cycles 1-10 follow the same pattern
for nr in range(1, 11):
cycle = models.Cycle.objects.create(name="Cycle %02d" % nr,
description="Lofar Cycle %s" % nr,
start=datetime(2013+nr//2, 6 if nr%2==0 else 11, 1, 0, 0, 0, 0, tzinfo=timezone.utc),
stop=datetime(2013+(nr+1)//2, 6 if nr%2==1 else 11, 1, 0, 0, 0, 0, tzinfo=timezone.utc))
start=datetime(2013+nr//2, 5 if nr%2==0 else 11, 15, 0, 0, 0, 0, tzinfo=timezone.utc),
stop=datetime(2013+(nr+1)//2, 5 if nr%2==1 else 11, 14, 0, 0, 0, 0, tzinfo=timezone.utc))
models.CycleQuota.objects.bulk_create([models.CycleQuota(cycle=cycle,
resource_type=ResourceType.objects.get(name="observing_time"),
......@@ -162,6 +206,99 @@ def populate_cycles(apps, schema_editor):
resource_type=ResourceType.objects.get(name="observing_time_prio_b"),
value=0) # needs to be filled in by user (SOS)
])
cycles_info.append((cycle.name, cycle.start, cycle.stop))
# Cycle 11 deviates from any patterns
cycle = models.Cycle.objects.create(name="Cycle 11",
description="Lofar Cycle 11",
start=datetime(2018, 11, 15, 0, 0, 0, 0,
tzinfo=timezone.utc),
stop=datetime(2019, 5, 31, 0, 0, 0, 0,
tzinfo=timezone.utc))
models.CycleQuota.objects.bulk_create([models.CycleQuota(cycle=cycle,
resource_type=ResourceType.objects.get(
name="observing_time"),
value=0.8 * cycle.duration.total_seconds()),
# rough guess. 80% of total time available for observing
models.CycleQuota(cycle=cycle,
resource_type=ResourceType.objects.get(
name="cep_processing_time"),
value=0.8 * cycle.duration.total_seconds()),
models.CycleQuota(cycle=cycle,
resource_type=ResourceType.objects.get(
name="lta_storage"),
value=0), # needs to be filled in by user (SOS)
models.CycleQuota(cycle=cycle,
resource_type=ResourceType.objects.get(
name="support_time"),
value=0), # needs to be filled in by user (SOS)
models.CycleQuota(cycle=cycle,
resource_type=ResourceType.objects.get(
name="observing_time_commissioning"),
value=0.05 * cycle.duration.total_seconds()),
# rough guess. 5% of total time available for observing
models.CycleQuota(cycle=cycle,
resource_type=ResourceType.objects.get(
name="observing_time_prio_a"),
value=0), # needs to be filled in by user (SOS)
models.CycleQuota(cycle=cycle,
resource_type=ResourceType.objects.get(
name="observing_time_prio_b"),
value=0) # needs to be filled in by user (SOS)
])
cycles_info.append((cycle.name, cycle.start, cycle.stop))
# Cycles 12-19 follow the same pattern
for nr in range(12, 20):
cycle = models.Cycle.objects.create(name="Cycle %02d" % nr,
description="Lofar Cycle %s" % nr,
start=datetime(2013 + nr // 2, 6 if nr % 2 == 0 else 12, 1, 0, 0, 0, 0,
tzinfo=timezone.utc),
stop=datetime(2013 + (nr + 1) // 2, 5 if nr % 2 == 1 else 11,
30 if nr % 2 == 0 else 31, 0, 0,
0, 0, tzinfo=timezone.utc))
models.CycleQuota.objects.bulk_create([models.CycleQuota(cycle=cycle,
resource_type=ResourceType.objects.get(
name="observing_time"),
value=0.8 * cycle.duration.total_seconds()),
# rough guess. 80% of total time available for observing
models.CycleQuota(cycle=cycle,
resource_type=ResourceType.objects.get(
name="cep_processing_time"),
value=0.8 * cycle.duration.total_seconds()),
models.CycleQuota(cycle=cycle,
resource_type=ResourceType.objects.get(
name="lta_storage"),
value=0), # needs to be filled in by user (SOS)
models.CycleQuota(cycle=cycle,
resource_type=ResourceType.objects.get(
name="support_time"),
value=0), # needs to be filled in by user (SOS)
models.CycleQuota(cycle=cycle,
resource_type=ResourceType.objects.get(
name="observing_time_commissioning"),
value=0.05 * cycle.duration.total_seconds()),
# rough guess. 5% of total time available for observing
models.CycleQuota(cycle=cycle,
resource_type=ResourceType.objects.get(
name="observing_time_prio_a"),
value=0), # needs to be filled in by user (SOS)
models.CycleQuota(cycle=cycle,
resource_type=ResourceType.objects.get(
name="observing_time_prio_b"),
value=0) # needs to be filled in by user (SOS)
])
cycles_info.append((cycle.name, cycle.start, cycle.stop))
logger.info('\n')
for ci in cycles_info:
logger.info('%s\t\tStart: %s\t\tStop: %s' % ci)
logger.info('\n')
def populate_projects(apps, schema_editor):
from lofar.sas.tmss.test.tmss_test_data_django_models import SchedulingSet_test_data
......
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