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
2567ad16
Commit
2567ad16
authored
4 years ago
by
Jorrit Schaap
Browse files
Options
Downloads
Patches
Plain Diff
TMSS-189
: added a scheduling test for a scheduling_unit consisting of an observation and a pipeline
parent
b90d9fb9
No related branches found
No related tags found
1 merge request
!182
Resolve TMSS-189 (and TMSS-192)
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
SAS/TMSS/test/t_scheduling.py
+56
-0
56 additions, 0 deletions
SAS/TMSS/test/t_scheduling.py
with
56 additions
and
0 deletions
SAS/TMSS/test/t_scheduling.py
+
56
−
0
View file @
2567ad16
...
...
@@ -167,6 +167,62 @@ class SchedulingTest(unittest.TestCase):
self
.
assertEqual
(
'
scheduled
'
,
ra_test_env
.
radb
.
getTask
(
tmss_id
=
pipe_subtask
[
'
id
'
])[
'
status
'
])
def
test_schedule_schedulingunit_enough_resources_available
(
self
):
'''
similar test as test_schedule_pipeline_subtask_with_enough_resources_available, but now created from a scheduling_unit
'''
with
tmss_test_env
.
create_tmss_client
()
as
client
:
scheduling_unit_template
=
client
.
get_schedulingunit_template
(
"
scheduling unit schema
"
)
scheduling_unit_doc
=
get_default_json_object_for_schema
(
scheduling_unit_template
[
'
schema
'
])
# define an observation without QA
obs_task
=
get_default_json_object_for_schema
(
client
.
get_task_template
(
name
=
"
observation schema
"
)[
'
schema
'
])
obs_task
[
'
QA
'
][
'
plots
'
][
'
enabled
'
]
=
False
obs_task
[
'
QA
'
][
'
file_conversion
'
][
'
enabled
'
]
=
False
scheduling_unit_doc
[
'
tasks
'
].
append
({
"
name
"
:
"
Observation
"
,
"
specifications_doc
"
:
obs_task
,
"
specifications_template
"
:
"
observation schema
"
})
# define a pipeline
scheduling_unit_doc
[
'
tasks
'
].
append
({
"
name
"
:
"
Pipeline
"
,
"
specifications_doc
"
:
get_default_json_object_for_schema
(
client
.
get_task_template
(
name
=
"
preprocessing schema
"
)[
'
schema
'
]),
"
specifications_template
"
:
"
preprocessing schema
"
})
# connect obs to pipeline
scheduling_unit_doc
[
'
task_relations
'
].
append
({
"
producer
"
:
"
Observation
"
,
"
consumer
"
:
"
Pipeline
"
,
"
input
"
:
{
"
role
"
:
"
input
"
,
"
datatype
"
:
"
visibilities
"
},
"
output
"
:
{
"
role
"
:
"
correlator
"
,
"
datatype
"
:
"
visibilities
"
},
"
dataformat
"
:
"
MeasurementSet
"
,
"
selection_doc
"
:
{},
"
selection_template
"
:
"
All
"
})
# submit
scheduling_unit_draft_data
=
test_data_creator
.
SchedulingUnitDraft
(
template_url
=
scheduling_unit_template
[
'
url
'
],
requirements_doc
=
scheduling_unit_doc
)
scheduling_unit_draft
=
test_data_creator
.
post_data_and_get_response_as_json_object
(
scheduling_unit_draft_data
,
'
/scheduling_unit_draft/
'
)
# create the whole blueprints tree...
scheduling_unit_blueprint
=
client
.
create_blueprints_and_subtasks_from_scheduling_unit_draft
(
scheduling_unit_draft
[
'
id
'
])
# fetch the created task_blueprints
task_blueprints
=
[
client
.
get_url_as_json_object
(
task_blueprint_url
)
for
task_blueprint_url
in
scheduling_unit_blueprint
[
'
task_blueprints
'
]]
self
.
assertEqual
(
2
,
len
(
task_blueprints
))
# and make sure they are ordered correctly
if
"
Pipeline
"
in
task_blueprints
[
0
][
'
name
'
]:
task_blueprints
.
reverse
()
for
task_blueprint
in
task_blueprints
:
self
.
assertEqual
(
1
,
len
(
task_blueprint
[
'
subtasks
'
]))
subtask
=
client
.
get_url_as_json_object
(
task_blueprint
[
'
subtasks
'
][
0
])
client
.
set_subtask_status
(
subtask
[
'
id
'
],
'
defined
'
)
subtask
=
client
.
schedule_subtask
(
subtask
[
'
id
'
])
self
.
assertEqual
(
'
scheduled
'
,
subtask
[
'
state_value
'
])
self
.
assertEqual
(
'
scheduled
'
,
ra_test_env
.
radb
.
getTask
(
tmss_id
=
subtask
[
'
id
'
])[
'
status
'
])
client
.
set_subtask_status
(
subtask
[
'
id
'
],
'
finished
'
)
if
__name__
==
"
__main__
"
:
os
.
environ
[
'
TZ
'
]
=
'
UTC
'
unittest
.
main
()
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