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
b4834e3a
Commit
b4834e3a
authored
4 years ago
by
Jorrit Schaap
Browse files
Options
Downloads
Patches
Plain Diff
TMSS-190
: prepare some nice scheduling units for projects with different priorities
parent
8c5cdc69
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!252
Resolve TMSS-190
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
SAS/TMSS/src/tmss/tmssapp/populate.py
+14
-13
14 additions, 13 deletions
SAS/TMSS/src/tmss/tmssapp/populate.py
with
14 additions
and
13 deletions
SAS/TMSS/src/tmss/tmssapp/populate.py
+
14
−
13
View file @
b4834e3a
...
@@ -62,33 +62,34 @@ def populate_test_data():
...
@@ -62,33 +62,34 @@ def populate_test_data():
strategy_template
=
models
.
SchedulingUnitObservingStrategyTemplate
.
objects
.
get
(
name
=
"
UC1 CTC+pipelines
"
)
strategy_template
=
models
.
SchedulingUnitObservingStrategyTemplate
.
objects
.
get
(
name
=
"
UC1 CTC+pipelines
"
)
tmss_projects
=
models
.
Project
.
objects
.
filter
(
name__startswith
=
"
TMSS-
Commissioning
"
).
order_by
(
'
priority_rank
'
).
all
()
tmss_projects
=
models
.
Project
.
objects
.
filter
(
name__startswith
=
"
TMSS-
"
).
order_by
(
'
priority_rank
'
).
all
()
for
project_nr
,
tmss_project
in
enumerate
(
tmss_projects
):
for
project_nr
,
tmss_project
in
enumerate
(
tmss_projects
):
for
set_nr
in
range
(
1
):
project_prio_string
=
tmss_project
.
name
.
replace
(
"
TMSS-
"
,
""
)
# create a Test Scheduling Set UC1 under project TMSS-Commissioning
project_prio_name
=
tmss_project
.
name
.
replace
(
"
TMSS-Commissioning
"
,
""
)
for
set_nr
in
range
(
2
):
scheduling_set_data
=
SchedulingSet_test_data
(
name
=
"
Test
Scheduling Set UC1 example %s (%s)
"
%
(
set_nr
,
project_prio_
name
),
project
=
tmss_project
)
scheduling_set_data
=
SchedulingSet_test_data
(
name
=
"
Scheduling Set UC1 example %s (%s)
"
%
(
set_nr
,
project_prio_
string
),
project
=
tmss_project
)
scheduling_set
=
models
.
SchedulingSet
.
objects
.
create
(
**
scheduling_set_data
)
scheduling_set
=
models
.
SchedulingSet
.
objects
.
create
(
**
scheduling_set_data
)
scheduling_set
.
tags
=
[
"
TEST
"
,
"
UC1
"
]
scheduling_set
.
save
()
logger
.
info
(
'
created test scheduling_set: %s
'
,
scheduling_set
.
name
)
logger
.
info
(
'
created test scheduling_set: %s
'
,
scheduling_set
.
name
)
for
unit_nr
in
range
(
3
if
'
normal
'
in
project_prio_name
else
2
):
for
unit_nr
in
range
(
2
):
# the 'template' in the strategy_template is a predefined json-data blob which validates against the given scheduling_unit_template
# the 'template' in the strategy_template is a predefined json-data blob which validates against the given scheduling_unit_template
# a user might 'upload' a partial json-data blob, so add all the known defaults
# a user might 'upload' a partial json-data blob, so add all the known defaults
scheduling_unit_spec
=
add_defaults_to_json_object_for_schema
(
strategy_template
.
template
,
strategy_template
.
scheduling_unit_template
.
schema
)
scheduling_unit_spec
=
add_defaults_to_json_object_for_schema
(
strategy_template
.
template
,
strategy_template
.
scheduling_unit_template
.
schema
)
# TODO: TMSS-244 apply and implement daily constraints
# constraints_spec['daily']['require_day'] = unit_nr%2==0
# constraints_spec['daily']['require_night'] = unit_nr%2==1
# add the scheduling_unit_doc to a new SchedulingUnitDraft instance, and were ready to use it!
# add the scheduling_unit_doc to a new SchedulingUnitDraft instance, and were ready to use it!
scheduling_unit_draft
=
models
.
SchedulingUnitDraft
.
objects
.
create
(
name
=
"
UC1 p_%s.%s.%s
"
%
(
project_prio_name
,
set_nr
+
1
,
unit_nr
+
1
),
scheduling_unit_draft
=
models
.
SchedulingUnitDraft
.
objects
.
create
(
name
=
"
UC1 %s.%s.%s
"
%
(
'
day
'
if
constraints_spec
[
'
daily
'
][
'
require_day
'
]
else
'
night
'
if
constraints_spec
[
'
daily
'
][
'
require_night
'
]
else
'
anytime
'
,
set_nr
+
1
,
unit_nr
+
1
),
scheduling_set
=
scheduling_set
,
scheduling_set
=
scheduling_set
,
requirements_template
=
strategy_template
.
scheduling_unit_template
,
requirements_template
=
strategy_template
.
scheduling_unit_template
,
requirements_doc
=
scheduling_unit_spec
,
requirements_doc
=
scheduling_unit_spec
,
observation_strategy_template
=
strategy_template
,
observation_strategy_template
=
strategy_template
,
scheduling_constraints_doc
=
constraints_spec
,
scheduling_constraints_doc
=
constraints_spec
,
scheduling_constraints_template
=
constraints_template
)
scheduling_constraints_template
=
constraints_template
)
scheduling_unit_draft
.
tags
=
[
"
TEST
"
,
"
UC1
"
]
scheduling_unit_draft
.
save
()
logger
.
info
(
'
created test scheduling_unit_draft: %s
'
,
scheduling_unit_draft
.
name
)
logger
.
info
(
'
created test scheduling_unit_draft: %s
'
,
scheduling_unit_draft
.
name
)
...
@@ -130,8 +131,8 @@ def populate_cycles(apps, schema_editor):
...
@@ -130,8 +131,8 @@ def populate_cycles(apps, schema_editor):
def
populate_projects
(
apps
,
schema_editor
):
def
populate_projects
(
apps
,
schema_editor
):
for
suffix
,
rank
in
((
"
high
priority
"
,
3
),
(
"
normal
priority
"
,
2
),
(
"
low
priority
"
,
1
)):
for
suffix
,
rank
in
((
"
high
"
,
3
),
(
"
normal
"
,
2
),
(
"
low
"
,
1
)):
tmss_project
=
models
.
Project
.
objects
.
create
(
name
=
"
TMSS-
Commissioning
"
+
suffix
,
tmss_project
=
models
.
Project
.
objects
.
create
(
name
=
"
TMSS-
"
+
suffix
,
description
=
"
Project for all TMSS tests and commissioning (%s)
"
%
(
suffix
,),
description
=
"
Project for all TMSS tests and commissioning (%s)
"
%
(
suffix
,),
priority_rank
=
rank
,
priority_rank
=
rank
,
can_trigger
=
False
,
can_trigger
=
False
,
...
...
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