From f4b2038732a8e4158bc9469a44c9e58f9cd963db Mon Sep 17 00:00:00 2001 From: Joshua Hesketh Date: Tue, 24 Feb 2015 17:35:07 +1100 Subject: [PATCH] Send results back on failure Change-Id: I2ffb64c4c96ab5d600e6381a74bf0c5080618ea3 --- turbo_hipster/lib/models.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/turbo_hipster/lib/models.py b/turbo_hipster/lib/models.py index 4b0afbd..7029aea 100644 --- a/turbo_hipster/lib/models.py +++ b/turbo_hipster/lib/models.py @@ -121,6 +121,7 @@ class Task(object): self._send_work_data() self.job.sendWorkException(str(e).encode('utf-8')) # No point trying the job, lets return here + self._send_final_results() return # From here we can log exceptions @@ -140,8 +141,6 @@ class Task(object): try: self._cleanup() self._upload_results() - # Finally, send updated work data and completed packets - self._send_final_results() except Exception as e: # If something failed during this section we have been unable # to upload the log. As such raise an exception to gearman @@ -154,6 +153,9 @@ class Task(object): self.messages.append('Exception: %s' % e) self._send_work_data() self.job.sendWorkException(str(e).encode('utf-8')) + finally: + # Finally, send updated work data and completed packets + self._send_final_results() def stop_working(self, number=None): # Check the number is for this job instance (None will cancel all)