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
22a16f79
Commit
22a16f79
authored
4 years ago
by
Mario Raciti
Browse files
Options
Downloads
Patches
Plain Diff
TMSS-474
: Update cycle start and stop dates to actual values
parent
a819f30a
No related branches found
No related tags found
1 merge request
!386
Resolve TMSS-474
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
SAS/TMSS/backend/src/tmss/tmssapp/populate.py
+140
-3
140 additions, 3 deletions
SAS/TMSS/backend/src/tmss/tmssapp/populate.py
with
140 additions
and
3 deletions
SAS/TMSS/backend/src/tmss/tmssapp/populate.py
+
140
−
3
View file @
22a16f79
...
...
@@ -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
,
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
=
"
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\t
Start: %s
\t\t
Stop: %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
...
...
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