From b8b253cfaf4525efdb34b1b285fa3e699c712a0a Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Fri, 8 Apr 2016 15:55:56 -0700 Subject: [PATCH] Ensure all jobs send a completion packet In the job handler, aborted jobs would never send a work_complete packet, which would cause the gearman server to track them indefinitely. Update the handler so that all jobs send either a work_complete or work_exception. Change-Id: Ia3b914762d46b1873888d5025e4ba86f9d042895 --- files/subunit-gearman-worker.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/files/subunit-gearman-worker.py b/files/subunit-gearman-worker.py index 5c64833..1633bc0 100644 --- a/files/subunit-gearman-worker.py +++ b/files/subunit-gearman-worker.py @@ -121,8 +121,7 @@ class SubunitRetriever(threading.Thread): # discarded by zuul. subunit_io = self._retrieve_subunit_v2(source_url, retry) if not subunit_io: - job.sendWorkException( - 'Unable to retrieve subunit stream'.encode('utf8')) + raise Exception('Unable to retrieve subunit stream') else: if subunit_io.closed: logging.debug("Pushing closed subunit file: %s" % @@ -132,7 +131,7 @@ class SubunitRetriever(threading.Thread): out_event = fields.copy() out_event["subunit"] = subunit_io self._write_to_db(out_event) - job.sendWorkComplete() + job.sendWorkComplete() except Exception as e: logging.exception("Exception handling log event.") job.sendWorkException(str(e).encode('utf-8'))