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
896b7dc0
Commit
896b7dc0
authored
4 years ago
by
Jorrit Schaap
Browse files
Options
Downloads
Patches
Plain Diff
TMSS-152
: logging
parent
af0ba75b
No related branches found
No related tags found
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/tasks.py
+13
-16
13 additions, 16 deletions
SAS/TMSS/src/tmss/tmssapp/tasks.py
with
13 additions
and
16 deletions
SAS/TMSS/src/tmss/tmssapp/tasks.py
+
13
−
16
View file @
896b7dc0
...
@@ -125,7 +125,7 @@ def create_task_blueprint_from_task_draft(task_draft: models.TaskDraft) -> model
...
@@ -125,7 +125,7 @@ def create_task_blueprint_from_task_draft(task_draft: models.TaskDraft) -> model
Create a task_blueprint from the task_draft
Create a task_blueprint from the task_draft
:raises Exception if instantiate fails.
:raises Exception if instantiate fails.
"""
"""
logger
.
debug
(
"
C
reat
e T
ask
B
lueprint from
T
ask
D
raft
(
id=%s
)
"
,
task_draft
.
pk
)
logger
.
debug
(
"
c
reat
ing t
ask
_b
lueprint from
t
ask
_d
raft id=%s
"
,
task_draft
.
pk
)
# get or create a scheduling_unit_blueprint from the scheduling_unit_draft
# get or create a scheduling_unit_blueprint from the scheduling_unit_draft
scheduling_unit_blueprint
=
task_draft
.
scheduling_unit_draft
.
scheduling_unit_blueprints
.
last
()
scheduling_unit_blueprint
=
task_draft
.
scheduling_unit_draft
.
scheduling_unit_blueprints
.
last
()
...
@@ -144,12 +144,12 @@ def create_task_blueprint_from_task_draft(task_draft: models.TaskDraft) -> model
...
@@ -144,12 +144,12 @@ def create_task_blueprint_from_task_draft(task_draft: models.TaskDraft) -> model
specifications_template
=
task_draft
.
specifications_template
specifications_template
=
task_draft
.
specifications_template
)
)
logger
.
info
(
"
T
ask
B
lueprint
(
id=%s
) created
from
T
ask
D
raft
(
id=%s
)
"
,
task_blueprint
.
pk
,
task_draft
.
pk
)
logger
.
info
(
"
created t
ask
_b
lueprint id=%s from
t
ask
_d
raft id=%s
"
,
task_blueprint
.
pk
,
task_draft
.
pk
)
# now that we have a task_blueprint, its time to refresh the task_draft so we get the non-cached fields
# now that we have a task_blueprint, its time to refresh the task_draft so we get the non-cached fields
task_draft
.
refresh_from_db
()
task_draft
.
refresh_from_db
()
# loop over consumers/producers, and 'copy'
'
the TaskRelationBlueprint from the TaskRelationDraft
# loop over consumers/producers, and 'copy' the TaskRelationBlueprint from the TaskRelationDraft
# this is only possible if both 'ends' of the task_relation are converted to a TaskBlueprint
# this is only possible if both 'ends' of the task_relation are converted to a TaskBlueprint
# so, when converting two TaskDrafts (for example an observation and a pipeline), then for the conversion
# so, when converting two TaskDrafts (for example an observation and a pipeline), then for the conversion
# of the first TaskDraft->TaskBlueprint no relation is setup,
# of the first TaskDraft->TaskBlueprint no relation is setup,
...
@@ -171,10 +171,10 @@ def create_task_blueprint_from_task_draft(task_draft: models.TaskDraft) -> model
...
@@ -171,10 +171,10 @@ def create_task_blueprint_from_task_draft(task_draft: models.TaskDraft) -> model
selection_doc
=
task_relation_draft
.
selection_doc
,
selection_doc
=
task_relation_draft
.
selection_doc
,
selection_template
=
task_relation_draft
.
selection_template
,
selection_template
=
task_relation_draft
.
selection_template
,
dataformat
=
task_relation_draft
.
dataformat
)
dataformat
=
task_relation_draft
.
dataformat
)
logger
.
info
(
"
Task B
lueprint
(
id=%s
)
connect
ed to T
ask
B
lueprint
(id=%s) via Task Relation Blueprint (
id=%s
)
"
,
logger
.
info
(
"
created task_relation_b
lueprint id=%s
which
connect
s t
ask
_b
lueprint
s producer_id=%s and consumer_
id=%s
"
,
task_blueprint
.
pk
,
producing_task_blueprint
.
pk
,
task_relation
_blueprint
.
pk
)
task_
relation_
blueprint
.
pk
,
producing_task_blueprint
.
pk
,
consuming_task
_blueprint
.
pk
,
)
# Do the sam 'trick' for Task Scheduling Relation Draft to Blueprint
# Do the sam
e
'trick' for Task Scheduling Relation Draft to Blueprint
task_draft_scheduling_relations
=
list
(
task_draft
.
first_to_connect
.
all
())
+
list
(
task_draft
.
second_to_connect
.
all
())
task_draft_scheduling_relations
=
list
(
task_draft
.
first_to_connect
.
all
())
+
list
(
task_draft
.
second_to_connect
.
all
())
for
task_scheduling_relation_draft
in
task_draft_scheduling_relations
:
for
task_scheduling_relation_draft
in
task_draft_scheduling_relations
:
for
first_task_blueprint
in
task_scheduling_relation_draft
.
first
.
task_blueprints
.
all
():
for
first_task_blueprint
in
task_scheduling_relation_draft
.
first
.
task_blueprints
.
all
():
...
@@ -185,16 +185,13 @@ def create_task_blueprint_from_task_draft(task_draft: models.TaskDraft) -> model
...
@@ -185,16 +185,13 @@ def create_task_blueprint_from_task_draft(task_draft: models.TaskDraft) -> model
second_id
=
second_task_blueprint
.
id
)
second_id
=
second_task_blueprint
.
id
)
except
models
.
TaskSchedulingRelationBlueprint
.
DoesNotExist
:
except
models
.
TaskSchedulingRelationBlueprint
.
DoesNotExist
:
# ...'else' create it.
# ...'else' create it.
task_scheduling_relation_blueprint
=
models
.
TaskSchedulingRelationBlueprint
.
objects
.
create
(
task_scheduling_relation_blueprint
=
models
.
TaskSchedulingRelationBlueprint
.
objects
.
create
(
first
=
first_task_blueprint
,
first
=
first_task_blueprint
,
second
=
second_task_blueprint
,
second
=
second_task_blueprint
,
time_offset
=
task_scheduling_relation_draft
.
time_offset
,
time_offset
=
task_scheduling_relation_draft
.
time_offset
,
placement
=
task_scheduling_relation_draft
.
placement
)
placement
=
task_scheduling_relation_draft
.
placement
)
logger
.
info
(
"
created task_scheduling_relation_blueprint id=%s which connects task_blueprints first_id=%s and second_id=%s, placement=%s time_offset=%s[sec]
"
,
logger
.
info
(
"
Task Blueprint (id=%s) connected via scheduling relation with id=%s
"
,
task_scheduling_relation_blueprint
.
pk
,
first_task_blueprint
.
pk
,
second_task_blueprint
.
pk
,
task_scheduling_relation_draft
.
placement
,
task_scheduling_relation_draft
.
time_offset
)
task_blueprint
.
pk
,
task_scheduling_relation_blueprint
.
pk
)
logger
.
info
(
"
The scheduling relation is:
'
%s
'
(id=%s)
'
%s
'
'
%s
'
(id=%s)
"
,
first_task_blueprint
.
name
,
first_task_blueprint
.
pk
,
task_scheduling_relation_blueprint
.
placement
,
second_task_blueprint
.
name
,
second_task_blueprint
.
pk
)
return
task_blueprint
return
task_blueprint
...
...
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