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
0300ffca
Commit
0300ffca
authored
8 years ago
by
Adriaan Renting
Browse files
Options
Downloads
Patches
Plain Diff
Task #10557: Get mom_id from parset instead of MoM DB
parent
2f123a40
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
SAS/ResourceAssignment/TaskPrescheduler/prescheduler.py
+13
-10
13 additions, 10 deletions
SAS/ResourceAssignment/TaskPrescheduler/prescheduler.py
with
13 additions
and
10 deletions
SAS/ResourceAssignment/TaskPrescheduler/prescheduler.py
+
13
−
10
View file @
0300ffca
...
...
@@ -142,24 +142,27 @@ class TaskPrescheduler(OTDBBusListener):
"""
#TODO might work for all tasks in the future
try
:
otdb_id
=
treeId
mom_ids
=
self
.
momquery
.
getMoMIdsForOTDBIds
([
otdb_id
])
if
mom_ids
:
mom_id
=
mom_ids
[
0
]
#Race condition when asking MoM as the mom-otdb-adapter might not have heard that the
#task is on approved and might still be on approved pending in MoM.
#mom_ids = self.momquery.getMoMIdsForOTDBIds([otdb_id])
#So we get the parset for all tasks we receive instead of just for the ones with
#a trigger.
parset
=
self
.
otdbrpc
.
taskGetSpecification
(
otdb_id
=
otdb_id
)[
'
specification
'
]
specification
=
resourceIndicatorsFromParset
(
parset
)
if
specification
[
"
Observation.momID
"
]:
mom_id
=
specification
[
"
Observation.momID
"
]
logger
.
info
(
'
Found mom_id %s for otdb_id %s
'
,
(
mom_id
,
otdb_id
))
else
:
mom_id
=
None
if
len
(
mom_ids
)
>
1
:
logger
.
warning
(
'
Found multiple mom_ids %s
'
,
mom_ids
)
if
mom_id
:
response
=
self
.
momquery
.
get_trigger_id
(
mom_id
)
if
response
[
'
status
'
]
==
'
OK
'
:
logger
.
info
(
'
Found a task mom_id=%s with a trigger_id=%s
'
,
mom_id
,
response
[
'
trigger_id
'
])
#TODO, check for stations and other resources, start/endtime, target position, then update specification
parset
=
self
.
otdbrpc
.
taskGetSpecification
(
otdb_id
=
otdb_id
)[
'
specification
'
]
specification
=
resourceIndicatorsFromParset
(
parset
)
cobalt_values
=
calculateCobaltSettings
(
specification
)
logger
.
info
(
'
prescheduling otdb_id=%s because it was generated by trigger_id=%s
'
,
otdb_id
,
response
[
'
trigger_id
'
])
logger
.
info
(
'
prescheduling otdb_id=%s because it was generated by trigger_id=%s
'
,
(
otdb_id
,
response
[
'
trigger_id
'
])
)
otdb_info
=
{}
otdb_info
[
OUTPUT_PREFIX
+
"
Cobalt.Correlator.nrBlocksPerIntegration
"
]
=
cobalt_values
[
"
nrBlocks
"
]
otdb_info
[
OUTPUT_PREFIX
+
"
Cobalt.Correlator.nrIntegrationsPerBlock
"
]
=
cobalt_values
[
"
nrSubblocks
"
]
...
...
@@ -167,9 +170,9 @@ class TaskPrescheduler(OTDBBusListener):
otdb_info
[
OUTPUT_PREFIX
+
"
Cobalt.Correlator.integrationTime
"
]
=
cobalt_values
[
"
integrationTime
"
]
self
.
setOTDBinfo
(
otdb_id
,
otdb_info
,
'
prescheduled
'
)
else
:
logger
.
info
(
'
Did not find a trigger for task mom_id=%s, because %s
'
,
mom_id
,
response
[
'
errors
'
])
logger
.
info
(
'
Did not find a trigger for task mom_id=%s, because %s
'
,
(
mom_id
,
response
[
'
errors
'
])
)
else
:
logger
.
info
(
'
Did not find a mom_id for task otdb_id=%s
'
,
otdb_id
)
logger
.
info
(
'
Did not find a mom_id for task otdb_id=%s
'
,
(
otdb_id
,)
)
except
Exception
as
e
:
logger
.
error
(
e
)
...
...
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