diff --git a/SAS/ResourceAssignment/ResourceAssigner/lib/schedulechecker.py b/SAS/ResourceAssignment/ResourceAssigner/lib/schedulechecker.py index 581d65b92d80bce112b288ce1b67bbaf577aab5a..80c2c3e5ecd989c8f3f525e35f39af65d63227be 100644 --- a/SAS/ResourceAssignment/ResourceAssigner/lib/schedulechecker.py +++ b/SAS/ResourceAssignment/ResourceAssigner/lib/schedulechecker.py @@ -219,19 +219,19 @@ class ScheduleChecker(): task['status'], mom_status) - #if mom_status in ['opened', 'described']: - ## auto delete data for tasks which went back to opened in mom (for pipeline restarts for example) - ## The reason to delete it here is because otherwise the cleanupservice tries to get it's info from an already deleted task in radb/otdb - #path_result = self._curpc.getPathForOTDBId(task['otdb_id']) - #if path_result['found']: - #logger.info("removing data on disk from previous run for otdb_id %s", task['otdb_id']) - #result = self._curpc.removeTaskData(task['otdb_id']) - - #if not result['deleted']: - #logger.warning("could not remove all data on disk from previous run for otdb_id %s: %s", task['otdb_id'], result['message']) - - ## delete the spec (and task/claims etc via cascading delete) from radb to get it in sync again with mom - #self._radbrpc.deleteSpecification(task['specification_id']) + if mom_status in ['opened', 'described']: + # auto delete data for tasks which went back to opened in mom (for pipeline restarts for example) + # The reason to delete it here is because otherwise the cleanupservice tries to get it's info from an already deleted task in radb/otdb + path_result = self._curpc.getPathForOTDBId(task['otdb_id']) + if path_result['found']: + logger.info("removing data on disk from previous run for otdb_id %s", task['otdb_id']) + result = self._curpc.removeTaskData(task['otdb_id']) + + if not result['deleted']: + logger.warning("could not remove all data on disk from previous run for otdb_id %s: %s", task['otdb_id'], result['message']) + + # delete the spec (and task/claims etc via cascading delete) from radb to get it in sync again with mom + self._radbrpc.deleteSpecification(task['specification_id']) except Exception as e: logger.error("Error while checking unrun task mom_id=%s otdb_id=%s radb_id=%s for MoM opened/described/suspended status: %s", task['mom_id'],