Skip to content
Snippets Groups Projects
Commit 346f2695 authored by Jan David Mol's avatar Jan David Mol
Browse files

Task #8888: Changed TaskSpecification parameters from ({"OtdbID":x}) to (OtdbID=x)

parent 2415cf70
No related branches found
No related tags found
No related merge requests found
...@@ -239,7 +239,7 @@ class PostgressTaskSpecificationRequest(PostgressMessageHandlerInterface): ...@@ -239,7 +239,7 @@ class PostgressTaskSpecificationRequest(PostgressMessageHandlerInterface):
def __init__(self, **kwargs): def __init__(self, **kwargs):
super(PostgressTaskSpecificationRequest, self).__init__(**kwargs) super(PostgressTaskSpecificationRequest, self).__init__(**kwargs)
def handle_message(self, msg): def handle_message(self, **msg):
" Connect to the right function" " Connect to the right function"
return TaskSpecificationRequest(msg, self.connection) return TaskSpecificationRequest(msg, self.connection)
...@@ -251,7 +251,7 @@ class PostgressStatusUpdateCommand(PostgressMessageHandlerInterface): ...@@ -251,7 +251,7 @@ class PostgressStatusUpdateCommand(PostgressMessageHandlerInterface):
def __init__(self, **kwargs): def __init__(self, **kwargs):
super(PostgressStatusUpdateCommand, self).__init__(**kwargs) super(PostgressStatusUpdateCommand, self).__init__(**kwargs)
def handle_message(self, msg): def handle_message(self, **msg):
" Connect to the right function" " Connect to the right function"
return StatusUpdateCommand(msg, self.connection) return StatusUpdateCommand(msg, self.connection)
...@@ -263,7 +263,7 @@ class PostgressKeyUpdateCommand(PostgressMessageHandlerInterface): ...@@ -263,7 +263,7 @@ class PostgressKeyUpdateCommand(PostgressMessageHandlerInterface):
def __init__(self, **kwargs): def __init__(self, **kwargs):
super(PostgressKeyUpdateCommand, self).__init__(**kwargs) super(PostgressKeyUpdateCommand, self).__init__(**kwargs)
def handle_message(self, msg): def handle_message(self, **msg):
" Connect to the right function" " Connect to the right function"
return KeyUpdateCommand(msg, self.connection) return KeyUpdateCommand(msg, self.connection)
......
...@@ -37,7 +37,7 @@ logger = logging.getLogger(__name__) ...@@ -37,7 +37,7 @@ logger = logging.getLogger(__name__)
def do_rpc(rpc_instance, arg_dict): def do_rpc(rpc_instance, arg_dict):
# try: # try:
(data, status) = (rpc_instance)(arg_dict) (data, status) = (rpc_instance)(**arg_dict)
if status != "OK": if status != "OK":
raise Exception("Status returned is %s" % status) raise Exception("Status returned is %s" % status)
for key in sorted(data): for key in sorted(data):
......
...@@ -178,7 +178,7 @@ class JobsToSchedule(OTDBBusListener): ...@@ -178,7 +178,7 @@ class JobsToSchedule(OTDBBusListener):
# Request the parset # Request the parset
main_obsID = treeId main_obsID = treeId
main_parset,_ = self.parset_rpc( { "OtdbID": main_obsID } ) main_parset,_ = self.parset_rpc( OtdbID=main_obsID )
# Construct a dict of all the parsets we retrieved # Construct a dict of all the parsets we retrieved
parsets = {} parsets = {}
...@@ -202,7 +202,7 @@ class JobsToSchedule(OTDBBusListener): ...@@ -202,7 +202,7 @@ class JobsToSchedule(OTDBBusListener):
logger.info("Fetching predecessor %s", obsID) logger.info("Fetching predecessor %s", obsID)
# Request predecessor parset # Request predecessor parset
parsets[obsID],_ = self.parset_rpc( { "OtdbID": obsID } ) parsets[obsID],_ = self.parset_rpc( OtdbID=obsID )
# Add the list of predecessors # Add the list of predecessors
request_obsIDs = request_obsIDs.union(predecessors(parsets[obsID])) request_obsIDs = request_obsIDs.union(predecessors(parsets[obsID]))
......
...@@ -80,23 +80,21 @@ class TestService(unittest.TestCase): ...@@ -80,23 +80,21 @@ class TestService(unittest.TestCase):
self.requested_parsets = 0 self.requested_parsets = 0
# setup mock parset service # setup mock parset service
def TaskSpecificationService( input_dict ): def TaskSpecificationService( OtdbID ):
obsid = input_dict["OtdbID"] if OtdbID == 1:
if obsid == 1:
predecessors = "[2,3]" predecessors = "[2,3]"
elif obsid == 2: elif OtdbID == 2:
predecessors = "[3]" predecessors = "[3]"
elif obsid == 3: elif OtdbID == 3:
predecessors = "[]" predecessors = "[]"
else: else:
raise Exception("Invalid obsID") raise Exception("Invalid OtdbID: %s" % OtdbID)
self.requested_parsets += 1 self.requested_parsets += 1
return { return {
"Version.number": "1", "Version.number": "1",
PARSET_PREFIX + "Observation.ObsID": str(obsid), PARSET_PREFIX + "Observation.ObsID": str(OtdbID),
PARSET_PREFIX + "Observation.Scheduler.predecessors": predecessors, PARSET_PREFIX + "Observation.Scheduler.predecessors": predecessors,
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment