Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LOFAR
Manage
Activity
Members
Labels
Plan
Issues
Wiki
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review 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
RadioObservatory
LOFAR
Commits
e35bc979
Commit
e35bc979
authored
4 years ago
by
Jorrit Schaap
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' into
TMSS-672
parents
14d68034
e951e61a
No related branches found
No related tags found
1 merge request
!394
Resolve TMSS-672
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
SAS/TMSS/backend/src/tmss/tmssapp/populate.py
+134
-23
134 additions, 23 deletions
SAS/TMSS/backend/src/tmss/tmssapp/populate.py
SAS/TMSS/backend/src/tmss/tmssapp/serializers/specification.py
+2
-0
2 additions, 0 deletions
...MSS/backend/src/tmss/tmssapp/serializers/specification.py
with
136 additions
and
23 deletions
SAS/TMSS/backend/src/tmss/tmssapp/populate.py
+
134
−
23
View file @
e35bc979
...
...
@@ -133,36 +133,158 @@ def populate_test_data():
def
populate_cycles
(
apps
,
schema_editor
):
for
nr
in
range
(
0
,
18
):
# 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
=
"
LOFAR 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
=
"
LOFAR Support Time
"
),
value
=
0
),
# needs to be filled in by user (SOS)
models
.
CycleQuota
(
cycle
=
cycle
,
resource_type
=
ResourceType
.
objects
.
get
(
name
=
"
LOFAR 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
=
"
LOFAR Observing Time prio A
"
),
value
=
0
),
# needs to be filled in by user (SOS)
models
.
CycleQuota
(
cycle
=
cycle
,
resource_type
=
ResourceType
.
objects
.
get
(
name
=
"
LOFAR Observing Time prio B
"
),
value
=
0
)
# needs to be filled in by user (SOS)
])
# 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
,
1
5
,
0
,
0
,
0
,
0
,
tzinfo
=
timezone
.
utc
),
stop
=
datetime
(
2013
+
(
nr
+
1
)
//
2
,
5
if
nr
%
2
==
1
else
11
,
1
4
,
0
,
0
,
0
,
0
,
tzinfo
=
timezone
.
utc
))
models
.
CycleQuota
.
objects
.
bulk_create
([
models
.
CycleQuota
(
cycle
=
cycle
,
resource_type
=
ResourceType
.
objects
.
get
(
name
=
"
o
bserving
_t
ime
"
),
resource_type
=
ResourceType
.
objects
.
get
(
name
=
"
LOFAR O
bserving
T
ime
"
),
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_p
rocessing
_t
ime
"
),
resource_type
=
ResourceType
.
objects
.
get
(
name
=
"
CEP P
rocessing
T
ime
"
),
value
=
0.8
*
cycle
.
duration
.
total_seconds
()),
models
.
CycleQuota
(
cycle
=
cycle
,
resource_type
=
ResourceType
.
objects
.
get
(
name
=
"
lta_s
torage
"
),
resource_type
=
ResourceType
.
objects
.
get
(
name
=
"
LTA S
torage
"
),
value
=
0
),
# needs to be filled in by user (SOS)
models
.
CycleQuota
(
cycle
=
cycle
,
resource_type
=
ResourceType
.
objects
.
get
(
name
=
"
s
upport
_t
ime
"
),
resource_type
=
ResourceType
.
objects
.
get
(
name
=
"
LOFAR S
upport
T
ime
"
),
value
=
0
),
# needs to be filled in by user (SOS)
models
.
CycleQuota
(
cycle
=
cycle
,
resource_type
=
ResourceType
.
objects
.
get
(
name
=
"
o
bserving
_t
ime
_c
ommissioning
"
),
resource_type
=
ResourceType
.
objects
.
get
(
name
=
"
LOFAR O
bserving
T
ime
C
ommissioning
"
),
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
=
"
o
bserving
_t
ime
_
prio
_a
"
),
resource_type
=
ResourceType
.
objects
.
get
(
name
=
"
LOFAR O
bserving
T
ime
prio
A
"
),
value
=
0
),
# needs to be filled in by user (SOS)
models
.
CycleQuota
(
cycle
=
cycle
,
resource_type
=
ResourceType
.
objects
.
get
(
name
=
"
o
bserving
_t
ime
_
prio
_b
"
),
resource_type
=
ResourceType
.
objects
.
get
(
name
=
"
LOFAR O
bserving
T
ime
prio
B
"
),
value
=
0
)
# needs to be filled in by user (SOS)
])
# 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
=
"
LOFAR 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
=
"
LOFAR Support Time
"
),
value
=
0
),
# needs to be filled in by user (SOS)
models
.
CycleQuota
(
cycle
=
cycle
,
resource_type
=
ResourceType
.
objects
.
get
(
name
=
"
LOFAR 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
=
"
LOFAR Observing Time prio A
"
),
value
=
0
),
# needs to be filled in by user (SOS)
models
.
CycleQuota
(
cycle
=
cycle
,
resource_type
=
ResourceType
.
objects
.
get
(
name
=
"
LOFAR Observing Time prio B
"
),
value
=
0
)
# needs to be filled in by user (SOS)
])
# 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
=
"
LOFAR 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
=
"
LOFAR Support Time
"
),
value
=
0
),
# needs to be filled in by user (SOS)
models
.
CycleQuota
(
cycle
=
cycle
,
resource_type
=
ResourceType
.
objects
.
get
(
name
=
"
LOFAR 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
=
"
LOFAR Observing Time prio A
"
),
value
=
0
),
# needs to be filled in by user (SOS)
models
.
CycleQuota
(
cycle
=
cycle
,
resource_type
=
ResourceType
.
objects
.
get
(
name
=
"
LOFAR Observing Time prio B
"
),
value
=
0
)
# needs to be filled in by user (SOS)
])
def
populate_projects
(
apps
,
schema_editor
):
from
lofar.sas.tmss.test.tmss_test_data_django_models
import
SchedulingSet_test_data
...
...
@@ -181,7 +303,7 @@ def populate_projects(apps, schema_editor):
# for convenience, create a schedulingset for each project
models
.
SchedulingSet
.
objects
.
create
(
**
SchedulingSet_test_data
(
name
=
"
Test Scheduling Set
"
,
project
=
tmss_project
))
project_quota
=
ProjectQuota
.
objects
.
create
(
project
=
tmss_project
,
value
=
1e12
,
resource_type
=
ResourceType
.
objects
.
get
(
name
=
"
lta_s
torage
"
))
project_quota
=
ProjectQuota
.
objects
.
create
(
project
=
tmss_project
,
value
=
1e12
,
resource_type
=
ResourceType
.
objects
.
get
(
name
=
"
LTA S
torage
"
))
sara_fs
=
Filesystem
.
objects
.
get
(
name
=
"
Lofar Storage (SARA)
"
)
models
.
ProjectQuotaArchiveLocation
.
objects
.
create
(
project_quota
=
project_quota
,
archive_location
=
sara_fs
)
...
...
@@ -191,18 +313,7 @@ def populate_resources(apps, schema_editor):
time_q
=
Quantity
.
objects
.
get
(
value
=
Quantity
.
Choices
.
TIME
.
value
)
number_q
=
Quantity
.
objects
.
get
(
value
=
Quantity
.
Choices
.
NUMBER
.
value
)
ResourceType
.
objects
.
bulk_create
([
ResourceType
(
name
=
"
lta_storage
"
,
description
=
"
Amount of storage in the LTA (in bytes)
"
,
quantity
=
bytes_q
),
ResourceType
(
name
=
"
cep_storage
"
,
description
=
"
Amount of storage on the CEP processing cluster (in bytes)
"
,
quantity
=
bytes_q
),
ResourceType
(
name
=
"
cep_processing_time
"
,
description
=
"
Processing time on the CEP processing cluster (in seconds)
"
,
quantity
=
time_q
),
ResourceType
(
name
=
"
observing_time
"
,
description
=
"
Observing time (in seconds)
"
,
quantity
=
time_q
),
ResourceType
(
name
=
"
observing_time_prio_a
"
,
description
=
"
Observing time with priority A (in seconds)
"
,
quantity
=
time_q
),
ResourceType
(
name
=
"
observing_time_prio_b
"
,
description
=
"
Observing time with priority B (in seconds)
"
,
quantity
=
time_q
),
ResourceType
(
name
=
"
observing_time_commissioning
"
,
description
=
"
Observing time for Commissioning/DDT (in seconds)
"
,
quantity
=
time_q
),
ResourceType
(
name
=
"
support_time
"
,
description
=
"
Support time by human (in seconds)
"
,
quantity
=
time_q
),
ResourceType
(
name
=
"
number_of_triggers
"
,
description
=
"
Number of trigger events (as integer)
"
,
quantity
=
number_q
),
# TODO these duplicates have names that front-end expects.
# TODO We should not have doubles.
ResourceType
(
name
=
"
LTA Storage
"
,
description
=
"
Amount of storage in the LTA (in bytes)
"
,
quantity
=
bytes_q
),
ResourceType
.
objects
.
bulk_create
([
ResourceType
(
name
=
"
LTA Storage
"
,
description
=
"
Amount of storage in the LTA (in bytes)
"
,
quantity
=
bytes_q
),
ResourceType
(
name
=
"
CEP Storage
"
,
description
=
"
Amount of storage on the CEP processing cluster (in bytes)
"
,
quantity
=
bytes_q
),
ResourceType
(
name
=
"
CEP Processing Time
"
,
description
=
"
Processing time on the CEP processing cluster (in seconds)
"
,
quantity
=
time_q
),
ResourceType
(
name
=
"
LOFAR Observing Time
"
,
description
=
"
Observing time (in seconds)
"
,
quantity
=
time_q
),
...
...
This diff is collapsed.
Click to expand it.
SAS/TMSS/backend/src/tmss/tmssapp/serializers/specification.py
+
2
−
0
View file @
e35bc979
...
...
@@ -171,6 +171,8 @@ class ProjectSerializer(DynamicRelationalHyperlinkedModelSerializer):
class
ProjectQuotaSerializer
(
DynamicRelationalHyperlinkedModelSerializer
):
project_quota_archive_location
=
serializers
.
HyperlinkedRelatedField
(
'
projectquotaarchivelocation-detail
'
,
source
=
'
*
'
,
read_only
=
True
)
class
Meta
:
model
=
models
.
ProjectQuota
fields
=
'
__all__
'
...
...
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