From f24c76661a9dbba01479f8eb610ce139d8245649 Mon Sep 17 00:00:00 2001 From: DrFrasierCrane Date: Thu, 3 Jan 2008 18:09:32 +0100 Subject: [PATCH] Improved error handling in JobManager. --- straw/JobManager.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/straw/JobManager.py b/straw/JobManager.py index d8e5e82..9756e11 100644 --- a/straw/JobManager.py +++ b/straw/JobManager.py @@ -240,24 +240,26 @@ class TaskThread(Thread): if task: error.debug(self.getName() + " is munching task with id = %d" % task.id) self._task_started(task) + result = None try: result = self._process(task) - self._post_result(task, result) - error.debug(self.getName() + " is posting result to task with id = %d" % task.id) except Exception, e: error.debug(self.getName() + " threw exception while processing task with id = %d [%s]" % (task.id, str(e))) error.log_exc("Details:") - self.task_queue.task_done() + self._post_result(task, result) def job_done(self): error.debug(self.getName() + " got job_done") self.quit = True def _post_result(self, task, result): + error.debug(self.getName() + " is posting result to task with id = %d" % task.id) + task_result = TaskResult(task, result) self.result_queue.put_nowait(task_result) + self.task_queue.task_done() self.handler._notify("task-done", task_result) def _prepare_task_info(self, task_info): -- 2.11.4.GIT