Skip to content

Commit

Permalink
Added Zookeeper timeout config knob in ST
Browse files Browse the repository at this point in the history
Config knob "zk_timeout" for Zookeeper timeout is added in Schema Transformer.
ZookeeperClient now takes in arguemet for zk_timeout for which default has been
set to 400.

Change-Id: Ia1a5569292f4957dba4b3f64aaee997d7db9f9da
Closes-Bug: 1643846
  • Loading branch information
sahilsabharwal committed Dec 7, 2016
1 parent 5799b70 commit 793fffd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/config/common/zkclient.py
Expand Up @@ -220,7 +220,7 @@ def delete_all(cls, zookeeper_client, path):

class ZookeeperClient(object):

def __init__(self, module, server_list, logging_fn=None):
def __init__(self, module, server_list, logging_fn=None, zk_timeout=400):
# logging
logger = logging.getLogger(module)
logger.setLevel(logging.DEBUG)
Expand All @@ -245,7 +245,7 @@ def __init__(self, module, server_list, logging_fn=None):
sleep_func=gevent.sleep)
self._zk_client = kazoo.client.KazooClient(
server_list,
timeout=400,
timeout=zk_timeout,
handler=kazoo.handlers.gevent.SequentialGeventHandler(),
logger=logger,
connection_retry=self._retry,
Expand Down
7 changes: 6 additions & 1 deletion src/config/schema-transformer/to_bgp.py
Expand Up @@ -641,6 +641,7 @@ def parse_args(args_str):
--use_syslog
--syslog_facility LOG_USER
--cluster_id <testbed-name>
--zk_timeout 400
[--reset_config]
'''

Expand Down Expand Up @@ -687,6 +688,7 @@ def parse_args(args_str):
'kombu_ssl_keyfile': '',
'kombu_ssl_certfile': '',
'kombu_ssl_ca_certs': '',
'zk_timeout': 400,
}
secopts = {
'use_certs': False,
Expand Down Expand Up @@ -803,6 +805,8 @@ def parse_args(args_str):
help="Start port for bgp-as-a-service proxy")
parser.add_argument("--bgpaas_port_end", type=int,
help="End port for bgp-as-a-service proxy")
parser.add_argument("--zk_timeout",
help="Timeout for ZookeeperClient")

args = parser.parse_args(remaining_argv)
if type(args.cassandra_server_list) is str:
Expand Down Expand Up @@ -862,7 +866,8 @@ def main(args_str=None):
else:
client_pfx = ''
zk_path_pfx = ''
_zookeeper_client = ZookeeperClient(client_pfx+"schema", args.zk_server_ip)
_zookeeper_client = ZookeeperClient(client_pfx+"schema", args.zk_server_ip,
zk_timeout =args.zk_timeout)
_zookeeper_client.master_election(zk_path_pfx + "/schema-transformer",
os.getpid(), run_schema_transformer,
args)
Expand Down

0 comments on commit 793fffd

Please sign in to comment.