Skip to content
Snippets Groups Projects
Commit 615f2d37 authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

SW-816: TaskPrescheduler now supplies the Specification class with an...

SW-816: TaskPrescheduler now supplies the Specification class with an RADatabase instance instead of an RADBRPC
parent 1a728b96
No related branches found
No related tags found
2 merge requests!59Merge LOFAR-Release-4_0 into master,!57Resolve SW-816
......@@ -32,7 +32,7 @@ from lofar.sas.otdb.OTDBBusListener import OTDBBusListener, OTDBEventMessageHand
from lofar.sas.otdb.otdbrpc import OTDBRPC
from lofar.mom.momqueryservice.momqueryrpc import MoMQueryRPC
from lofar.sas.resourceassignment.taskprescheduler.cobaltblocksize import CorrelatorSettings, StokesSettings, BlockConstraints, BlockSize
from lofar.sas.resourceassignment.resourceassignmentservice.rpc import RADBRPC
from lofar.sas.resourceassignment.database.radb import RADatabase
from lofar.sas.resourceassignment.common.specification import Specification
from lofar.sas.resourceassignment.common.specification import OUTPUT_PREFIX
......@@ -88,18 +88,18 @@ class TaskPrescheduler(OTDBEventMessageHandler):
super().__init__()
self.otdbrpc = OTDBRPC.create(exchange=exchange, broker=broker)
self.momquery = MoMQueryRPC.create(exchange=exchange, broker=broker)
self.radbrpc = RADBRPC.create(exchange=exchange, broker=broker)
self.radb = RADatabase()
def start_handling(self):
self.otdbrpc.open()
self.momquery.open()
self.radbrpc.open()
self.radb.connect()
super().start_handling()
def stop_handling(self):
self.otdbrpc.close()
self.momquery.close()
self.radbrpc.close()
self.radb.disconnect()
super().stop_handling()
def onObservationApproved(self, treeId, modificationTime):
......@@ -125,7 +125,7 @@ class TaskPrescheduler(OTDBEventMessageHandler):
# We get the parset for all tasks we receive instead of just for the ones with
# a trigger.
status = "approved"
spec = Specification(self.otdbrpc, self.momquery, self.radbrpc)
spec = Specification(self.otdbrpc, self.momquery, self.radb)
spec.set_status(status)
spec.read_from_OTDB_with_predecessors(treeId, "otdb", {}) #Now checks predecessors, which theoretically could cause race contitions
spec.read_from_mom()
......@@ -165,7 +165,7 @@ class TaskPrescheduler(OTDBEventMessageHandler):
except Exception as e:
logger.exception(e)
logger.error("Problem setting specification or status in OTDB for otdb_id=%s", otdb_id)
self.radbrpc.updateTaskStatusForOtdbId(otdb_id, 'error') # We don't catch an exception if this fails.
self.radb.updateTaskStatusForOtdbId(otdb_id, 'error') # We don't catch an exception if this fails.
def main():
from optparse import OptionParser
......
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