Browse files

Merge pull request #43 from klasy/klasys_zkfarmer

Fixed zkfarmer to recognize session CLOSED
  • Loading branch information...
rs committed Aug 23, 2018
2 parents 860d0c9 + fe23646 commit e2c749fdf5d56239769a513aea233d94429b7e84
Showing with 10 additions and 2 deletions.
  1. +10 −2 zkfarmer/
@@ -19,7 +19,7 @@
from .utils import serialize, unserialize, ip
from kazoo.exceptions import NoNodeError, NodeExistsError, ZookeeperError
from kazoo.client import KazooState, OPEN_ACL_UNSAFE
from kazoo.client import KazooState, KeeperState, OPEN_ACL_UNSAFE
class ZkFarmWatcher(object):
@@ -95,7 +95,7 @@ def loop(self, count=None, timeout=10, ignore_unknown_transitions=False):
if execute(*args) is False:
do = False
errors = 0
except ZookeeperError, e:
except ZookeeperError as e:
logger.exception("Got a zookeeper exception, reschedule the transition"), event, args))
do = False
@@ -343,3 +343,11 @@ def exec_znode_modified_from_idle(self):
except NoNodeError:
logger.warn("not able to watch for node %s: not exist anymore" % self.node_path)
def exec_connection_lost(self):
"""The connection might be closed here"""
logger.debug("We have the client (session) state of " + self.zkconn.client_state)
if self.zkconn.client_state == KeeperState.CLOSED:
logger.error("Zookeeper connection has been dropped since the session is closed and maximum number of retries reached")

0 comments on commit e2c749f

Please sign in to comment.