From 4b0091a82fb508037495c418d98e2be52ecd47f5 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Mon, 20 Apr 2015 14:48:20 -0700 Subject: [PATCH] Avoid attribute error by checking executor for being non-none Change-Id: I47e7a14a93026918f4a469139ca6a53dbaa1f702 --- taskflow/jobs/backends/impl_zookeeper.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/taskflow/jobs/backends/impl_zookeeper.py b/taskflow/jobs/backends/impl_zookeeper.py index 7aea3517..c73c1598 100644 --- a/taskflow/jobs/backends/impl_zookeeper.py +++ b/taskflow/jobs/backends/impl_zookeeper.py @@ -381,12 +381,16 @@ class ZookeeperJobBoard(base.NotifyingJobBoard): self._connected = False def _emit(self, state, details): - # Submit the work to the executor to avoid blocking the kazoo queue. + # Submit the work to the executor to avoid blocking the kazoo threads + # and queue(s)... + worker = self._worker + if worker is None: + return try: - self._worker.submit(self.notifier.notify, state, details) - except (AttributeError, RuntimeError): - # Notification thread is shutdown or non-existent, either case we - # just want to skip submitting a notification... + worker.submit(self.notifier.notify, state, details) + except RuntimeError: + # Notification thread is shutdown just skip submitting a + # notification... pass @property