Skip to content
GitLab
Explore
Sign in
Register
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
07e5e52a
Commit
07e5e52a
authored
5 years ago
by
Jorrit Schaap
Browse files
Options
Downloads
Patches
Plain Diff
SW-816
: use direct radb connection. No need for (slower) messaging here
parent
5e125ce8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!59
Merge LOFAR-Release-4_0 into master
,
!57
Resolve SW-816
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
SAS/ResourceAssignment/ResourceAssigner/lib/resource_assigner.py
+17
-16
17 additions, 16 deletions
...ourceAssignment/ResourceAssigner/lib/resource_assigner.py
with
17 additions
and
16 deletions
SAS/ResourceAssignment/ResourceAssigner/lib/resource_assigner.py
+
17
−
16
View file @
07e5e52a
...
...
@@ -32,7 +32,7 @@ from lofar.messaging.messagebus import ToBus
from
lofar.messaging
import
DEFAULT_BROKER
,
DEFAULT_BUSNAME
from
lofar.common.util
import
single_line_with_single_spaces
from
lofar.sas.resourceassignment.
resourceassignmentservice.rpc
import
RAD
BRPC
from
lofar.sas.resourceassignment.
database.radb
import
RAD
atabase
from
lofar.sas.otdb.otdbrpc
import
OTDBRPC
from
lofar.sas.resourceassignment.resourceassigner.config
import
DEFAULT_RA_NOTIFICATION_PREFIX
...
...
@@ -72,7 +72,7 @@ class ResourceAssigner(object):
:param radb_dbcreds: the credentials to be used for accessing the RADB (default: None, which means default)
"""
self
.
radb
rpc
=
RAD
BRPC
.
create
(
exchange
=
exchange
,
broker
=
broker
)
self
.
radb
=
RAD
atabase
(
dbcreds
=
radb_dbcreds
)
self
.
rerpc
=
ResourceEstimatorRPC
.
create
(
exchange
=
exchange
,
broker
=
broker
)
self
.
otdbrpc
=
OTDBRPC
.
create
(
exchange
=
exchange
,
broker
=
broker
)
self
.
momrpc
=
MoMQueryRPC
.
create
(
exchange
=
exchange
,
broker
=
broker
)
...
...
@@ -81,7 +81,7 @@ class ResourceAssigner(object):
self
.
ra_notification_bus
=
ToBus
(
exchange
=
exchange
,
broker
=
broker
)
self
.
obscontrol
=
ObservationControlRPCClient
.
create
(
exchange
=
exchange
,
broker
=
broker
)
self
.
resource_availability_checker
=
ResourceAvailabilityChecker
(
self
.
radb
rpc
)
self
.
resource_availability_checker
=
ResourceAvailabilityChecker
(
self
.
radb
)
# For the DwellScheduler instances created during run-time we store the following variables
self
.
radb_creds
=
radb_dbcreds
...
...
@@ -97,8 +97,8 @@ class ResourceAssigner(object):
self
.
close
()
def
open
(
self
):
"""
Open
rpc
connections to
radb
service
and resource estimator service
"""
self
.
radb
rpc
.
open
()
"""
Open connections to
various
service
/buses/databases
"""
self
.
radb
.
connect
()
self
.
rerpc
.
open
()
self
.
otdbrpc
.
open
()
self
.
momrpc
.
open
()
...
...
@@ -108,9 +108,9 @@ class ResourceAssigner(object):
self
.
obscontrol
.
open
()
def
close
(
self
):
"""
Close
rpc
connections to
radb
service
and resource estimator service
"""
"""
Close connections to
various
service
/buses/databases
"""
self
.
obscontrol
.
close
()
self
.
radb
rpc
.
close
()
self
.
radb
.
disconnect
()
self
.
rerpc
.
close
()
self
.
otdbrpc
.
close
()
self
.
momrpc
.
close
()
...
...
@@ -123,7 +123,7 @@ class ResourceAssigner(object):
def
resource_types
(
self
):
"""
Returns a dict of all the resource types, to convert name->id.
"""
return
{
rt
[
'
name
'
]:
rt
[
'
id
'
]
for
rt
in
self
.
radb
rpc
.
getResourceTypes
()}
return
{
rt
[
'
name
'
]:
rt
[
'
id
'
]
for
rt
in
self
.
radb
.
getResourceTypes
()}
def
do_assignment
(
self
,
otdb_id
,
specification_tree
):
"""
...
...
@@ -140,9 +140,9 @@ class ResourceAssigner(object):
:raises an Exception if something unforeseen happened while scheduling
"""
logger
.
info
(
(
'
do_assignment: otdb_id=%s specification_tree=%s
'
%
(
otdb_id
,
specification_tree
)
))
logger
.
info
(
'
do_assignment: otdb_id=%s specification_tree=%s
'
,
otdb_id
,
specification_tree
)
spec
=
Specification
(
self
.
otdbrpc
,
self
.
momrpc
,
self
.
radb
rpc
)
spec
=
Specification
(
self
.
otdbrpc
,
self
.
momrpc
,
self
.
radb
)
spec
.
from_dict
(
specification_tree
)
spec
.
insert_into_radb
()
# TODO Move this to TaskSpecified?
...
...
@@ -288,13 +288,14 @@ class ResourceAssigner(object):
(
scheduler_result
,
changed_tasks
)
=
scheduler
.
allocate_resources
()
if
not
scheduler_result
:
# try again with basic scheduler to end up with a situation with the 'normal' conflicting resources, which can then be evaluated by users
with
BasicScheduler
(
task_id
=
spec
.
radb_id
,
specification_tree
=
specification_tree
,
resource_estimator
=
self
.
_get_resource_estimates
,
resource_availability_checker
=
self
.
resource_availability_checker
,
radbcreds
=
self
.
radb_creds
)
as
basic_scheduler
:
basic_scheduler
=
BasicScheduler
(
task_id
=
spec
.
radb_id
,
specification_tree
=
specification_tree
,
resource_estimator
=
self
.
_get_resource_estimates
,
resource_availability_checker
=
self
.
resource_availability_checker
,
radbcreds
=
self
.
radb_creds
)
with
basic_scheduler
:
(
scheduler_result
,
changed_tasks
)
=
basic_scheduler
.
allocate_resources
()
return
scheduler_result
return
scheduler_result
elif
changed_tasks
:
for
t
in
changed_tasks
:
if
t
.
status
==
'
aborted
'
:
#MAC_Scheduler can't handle queued right now See also schedulers.py around line 600
...
...
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