python-zk / kazoo

Kazoo is a high-level Python library that makes it easier to use Apache Zookeeper.
https://kazoo.readthedocs.io
Apache License 2.0
1.3k stars 387 forks source link

Deprecation Warning [pass a configured retry object] #504

Closed aliartiza75 closed 5 years ago

aliartiza75 commented 6 years ago

Hello everyone,

I am trying to connect to a zookeeper node(code given below):

zk_client = KazooClient(hosts=zk_addr, connection_retry=3, retry_delay=5)

But always got the following warning:

DeprecationWarning: Passing retry configuration param retry_delay to the client directly is deprecated, please pass a configured retry object (using param delay)

It says :

please pass a configured retry object (using param delay)

I don't understand warning message, need direction in this regards.

Thank you

jeffwidman commented 6 years ago

This looks like something Kazoo needs to be updated to handle... ie, a valid bug due to a deprecation.

What version of Zookeeper is this?

aliartiza75 commented 6 years ago

My zookeeper version is 3.4.10-XXXXXXX

aliartiza75 commented 6 years ago

@jeffwidman waiting for your response.

jeffwidman commented 6 years ago

This looks like a valid issue. However, since it's only a deprecation, I would expect kazoo will continue to work. I don't have time right now to fix this, but I'm happy to review PR's if anyone else wants to tackle this.

aliartiza75 commented 6 years ago

@jeffwidman i am interested in it kindly guide me

jimbobhickville commented 5 years ago

It's pretty clearly documented in the Kazoo docs. You need to use a KazooRetry object instead of passing in an int. To accomplish that with your example, this should work:

from kazoo.retry import KazooRetry

retry = KazooRetry(max_tries=3
                                 delay=5,
                                 backoff=1)

zk_client = KazooClient(hosts=zk_addr, connection_retry=retry)
aliartiza75 commented 5 years ago

@jimbobhickville thank you