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
dc35dee5
Commit
dc35dee5
authored
4 years ago
by
goei
Browse files
Options
Downloads
Patches
Plain Diff
TMSS-152
: Proper solution to retrieve related scheduling subtask for calibrator
parent
01d6da99
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!180
Resolve TMSS-152
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
SAS/TMSS/src/tmss/tmssapp/subtasks.py
+29
-6
29 additions, 6 deletions
SAS/TMSS/src/tmss/tmssapp/subtasks.py
with
29 additions
and
6 deletions
SAS/TMSS/src/tmss/tmssapp/subtasks.py
+
29
−
6
View file @
dc35dee5
...
...
@@ -33,6 +33,7 @@ def create_subtasks_from_task_blueprint(task_blueprint: TaskBlueprint) -> [Subta
create_qaplots_subtask_from_task_blueprint
],
'
calibrator schema
'
:
[
create_observation_control_subtask_from_task_blueprint_calibrator_observation
,
# skip QA for now..can not handle multiple qa plots subtasks
# also use related task blueprint setting in case of calibrator
#create_qafile_subtask_from_task_blueprint,
#create_qaplots_subtask_from_task_blueprint
],
...
...
@@ -143,13 +144,14 @@ def create_observation_control_subtask_from_task_blueprint_calibrator_observatio
"""
logger
.
info
(
"
Task (id=%d) is a Calibrator Addon Observation
"
%
task_blueprint
.
pk
)
# Get the related Target Observation Task
# TODO:
# 1) The TaskSchedulingRelationDraft should be copied to TaskSchedulingRelationBlueprint during create blueprint
# 2) Get the
re
l
ate
d blueprint_task, which should be a Target Observation
# Somehow I can not retrieve it with ......objects.get(first="C
alibrator
O
bservation
1") ...???
r
el
ated_blueprint_target_observation
=
TaskBlueprint
.
objects
.
get
(
name
=
"
Task Blueprint of Target Observation
"
)
calibrator_add_on_spec
=
task_blueprint
.
specifications_doc
related_blueprint_target_observation
=
get_related_scheduling_blueprint_task
(
task_blueprint
)
if
related_blueprint_target_observation
is
None
:
raise
SubtaskCreationException
(
'
Cannot c
reate
observation control subtasks for task id=%s because no related scheduling blueprint task exists.
'
'
This is required for a c
alibrator
o
bservation
'
%
task_blueprint
.
pk
)
el
se
:
logger
.
info
(
"
Related scheduling blueprint task found id=%d
"
,
related_blueprint_target_observation
.
pk
)
calibrator_add_on_spec
=
task_blueprint
.
specifications_doc
subtask_specifications_doc
=
get_station_specifications_from_observation_blueprint
(
related_blueprint_target_observation
.
specifications_doc
)
# Retrieve pointings from the original calibrator AddOn specifications
subtask_specifications_doc
[
"
stations
"
][
"
analog_pointing
"
]
=
{
...
...
@@ -165,6 +167,26 @@ def create_observation_control_subtask_from_task_blueprint_calibrator_observatio
return
subtask
def
get_related_scheduling_blueprint_task
(
task_blueprint
):
"""
Retrieve the related scheduling blueprint task object
if nothing found return None
:param task_blueprint:
:return: related_scheduling_task_blueprint
"""
related_scheduling_task_blueprint
=
None
try
:
related_scheduling
=
TaskSchedulingRelationBlueprint
.
objects
.
get
(
first
=
task_blueprint
)
related_scheduling_task_blueprint
=
related_scheduling
.
second
except
TaskRelationBlueprint
.
DoesNotExist
:
try
:
related_scheduling
=
TaskSchedulingRelationBlueprint
.
objects
.
get
(
second
=
task_blueprint
)
related_scheduling_task_blueprint
=
related_scheduling
.
first
except
TaskRelationBlueprint
.
DoesNotExist
:
logger
.
info
(
"
No related scheduling blueprint task found for id=%d
"
,
task_blueprint
.
pk
)
return
related_scheduling_task_blueprint
def
create_observation_control_subtask_from_task_blueprint
(
task_blueprint
:
TaskBlueprint
,
extra_specifications_doc
)
->
Subtask
:
"""
Create an observation control subtask .
...
...
@@ -271,6 +293,7 @@ def create_qafile_subtask_from_observation_subtask(observation_subtask: Subtask)
# done, now return the subtask, and allow the system to wait for the predecessors to be finished before we schedule this qa_file_subtask
return
qafile_subtask
def
create_qaplots_subtask_from_task_blueprint
(
task_blueprint
:
TaskBlueprint
)
->
Subtask
:
qafile_subtasks
=
[
st
for
st
in
task_blueprint
.
subtasks
.
all
()
if
st
.
specifications_template
.
type
.
value
==
SubtaskType
.
Choices
.
QA_FILES
.
value
]
if
qafile_subtasks
:
...
...
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