import sys
from typing import Any, Dict, List, Optional, Tuple
-from kazoo.client import KazooClient
-from kazoo.protocol.states import WatchedEvent
-
import scott_secrets
# This module is commonly used by others in here and should avoid
# A zookeeper client that is lazily created so as to not incur
# the latency of connecting to zookeeper for programs that are
# not reading or writing their config data into zookeeper.
- self.zk: Optional[KazooClient] = None
+ self.zk: Optional[Any] = None
# Per known zk file, what is the max version we have seen?
self.max_version: Dict[str, int] = {}
sys.argv.append(value)
arg = ''
- def _process_dynamic_args(self, event: WatchedEvent):
+ def _process_dynamic_args(self, event):
assert self.zk
logger = logging.getLogger(__name__)
contents, meta = self.zk.get(event.path, watch=self._process_dynamic_args)
if loadfile is not None:
zkpath = None
if loadfile[:3] == 'zk:':
+ from kazoo.client import KazooClient
+
try:
if self.zk is None:
self.zk = KazooClient(
zkpath = re.sub(r'//+', '/', zkpath)
try:
if not self.zk:
+ from kazoo.client import KazooClient
+
self.zk = KazooClient(
hosts=scott_secrets.ZOOKEEPER_NODES,
use_ssl=True,