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

SW-800: some last fixes

parent 2c1c389b
No related branches found
No related tags found
No related merge requests found
......@@ -84,6 +84,21 @@ class BasicScheduler(object):
if self.starttime >= self.endtime:
raise ValueError('BasicScheduler, starttime=%s should be >= endtime=%s', self.starttime, self.endtime)
def __enter__(self):
self.open()
return self
def __exit__(self, exc_type, exc_val, exc_tb):
self.close()
def open(self):
""" Open radb connection"""
self.radb.connect()
def close(self):
""" Close radb connection"""
self.radb.disconnect()
def allocate_resources(self):
"""
Tries to allocate resources for the given estimates.
......@@ -496,19 +511,14 @@ class PriorityScheduler(StationScheduler):
def open(self):
""" Open connections to the required services """
super().open()
self.momqueryservice.open()
def close(self):
""" Close the connections with the used services """
super().close()
self.momqueryservice.close()
def __enter__(self):
self.open()
return self
def __exit__(self, exc_type, exc_val, exc_tb):
self.close()
def _pre_process_allocation(self):
""" Take care of actions to be taken prior to the scheduling of resources """
super(PriorityScheduler, self)._pre_process_allocation()
......
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