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

LSRT-16: log exceptions in scheduling. When the Dwell/Priority schedulers...

LSRT-16: log exceptions in scheduling. When the Dwell/Priority schedulers cannot allocated the required resources, then try again with basic scheduler to end up with a situation with the 'normal' conflicting resources, which can then be evaluated by users
parent ec90e793
No related branches found
No related tags found
No related merge requests found
......@@ -45,8 +45,7 @@ from lofar.sas.resourceassignment.resourceassigner.config import DEFAULT_RA_NOTI
from lofar.sas.resourceassignment.resourceassigner.config import DEFAULT_RA_NOTIFICATION_PREFIX
from lofar.sas.resourceassignment.resourceassigner.resource_availability_checker import ResourceAvailabilityChecker
from lofar.sas.resourceassignment.resourceassigner.schedulers import DwellScheduler
from lofar.sas.resourceassignment.resourceassigner.schedulers import PriorityScheduler
from lofar.sas.resourceassignment.resourceassigner.schedulers import BasicScheduler, DwellScheduler, PriorityScheduler
from lofar.mom.momqueryservice.momqueryrpc import MoMQueryRPC
from lofar.mom.momqueryservice.config import DEFAULT_MOMQUERY_BUSNAME, DEFAULT_MOMQUERY_SERVICENAME
......@@ -279,36 +278,44 @@ class ResourceAssigner(object):
:returns: True if successful, or False otherwise
"""
logger.info("Received good estimates, scheduling resources for task %i", spec.radb_id)
if spec.isTriggered():
min_starttime, max_starttime, duration = spec.calculate_dwell_values(spec.starttime, spec.duration,
spec.min_starttime, spec.max_endtime)
scheduler = DwellScheduler(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,
min_starttime=min_starttime,
max_starttime=max_starttime,
duration=duration)
else:
scheduler = PriorityScheduler(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)
try:
result = scheduler.allocate_resources()
if spec.isTriggered():
min_starttime, max_starttime, duration = spec.calculate_dwell_values(spec.starttime, spec.duration,
spec.min_starttime, spec.max_endtime)
scheduler = DwellScheduler(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,
min_starttime=min_starttime,
max_starttime=max_starttime,
duration=duration)
else:
scheduler = PriorityScheduler(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)
except Exception as e:
logger.error('Error in calling scheduler.allocate_resources: %s', e)
result = False
logger.exception('Error in scheduler._schedule_resources: %s', e)
return False
if result:
logger.info('Resources successfully allocated task_id=%s' % spec.radb_id)
else:
logger.info('No resources allocated task_id=%s' % spec.radb_id)
try:
if not scheduler.allocate_resources():
# try again with basic scheduler to end up with a situation with the 'normal' conflicting resources, which can then be evaluated by users
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)
return scheduler.allocate_resources()
except Exception as e:
logger.exception('Error in calling scheduler.allocate_resources: %s', e)
return False
return result
logger.info('Resources successfully allocated task_id=%s' % spec.radb_id)
return True
def _cleanup_earlier_generated_data(self, otdb_id, spec):
"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment