From 1d1013fd63bb6eebf0a8a382340f1c7c2536bb88 Mon Sep 17 00:00:00 2001 From: Jorrit Schaap <schaap@astron.nl> Date: Thu, 14 Apr 2016 18:06:40 +0000 Subject: [PATCH] Task #8887: set task to conflict upon error --- .../lib/propagator.py | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/SAS/ResourceAssignment/RAtoOTDBTaskSpecificationPropagator/lib/propagator.py b/SAS/ResourceAssignment/RAtoOTDBTaskSpecificationPropagator/lib/propagator.py index 8c612605a32..b902885226a 100755 --- a/SAS/ResourceAssignment/RAtoOTDBTaskSpecificationPropagator/lib/propagator.py +++ b/SAS/ResourceAssignment/RAtoOTDBTaskSpecificationPropagator/lib/propagator.py @@ -108,17 +108,21 @@ class RAtoOTDBPropagator(): self.otdbrpc.taskSetStatus(otdb_id, 'conflict') def doTaskScheduled(self, ra_id, otdb_id, mom_id): - logger.info('doTaskScheduled: otdb_id=%s mom_id=%s' % (otdb_id, mom_id)) - if not otdb_id: - logger.warning('doTaskScheduled no valid otdb_id: otdb_id=%s' % (otdb_id,)) - return - ra_info = self.getRAinfo(ra_id) - project = self.momrpc.getProjectDetails(mom_id) - logger.info(project) - project_name = "_".join(project[str(mom_id)]['project_name'].split()) - otdb_info = self.translator.CreateParset(otdb_id, ra_info, project_name) - logger.debug("Parset info for OTDB: %s" %otdb_info) - self.setOTDBinfo(otdb_id, otdb_info, 'scheduled') + try: + logger.info('doTaskScheduled: otdb_id=%s mom_id=%s' % (otdb_id, mom_id)) + if not otdb_id: + logger.warning('doTaskScheduled no valid otdb_id: otdb_id=%s' % (otdb_id,)) + return + ra_info = self.getRAinfo(ra_id) + project = self.momrpc.getProjectDetails(mom_id) + logger.info(project) + project_name = "_".join(project[str(mom_id)]['project_name'].split()) + otdb_info = self.translator.CreateParset(otdb_id, ra_info, project_name) + logger.debug("Parset info for OTDB: %s" %otdb_info) + self.setOTDBinfo(otdb_id, otdb_info, 'scheduled') + except Exception as e: + logger.error(e) + self.doTaskConflict(ra_id, otdb_id, mom_id) def getRAinfo(self, ra_id): info = {} -- GitLab