How to explicitly stop datawatch process started on a zNode using python module kazoo? Below is the way I created datawatch
from kazoo.recipe.watchers import DataWatch
datawatch = DataWatch(client=zookeeper_client, path=path_to_znode, func=callback_function)
I went through kazoo wiki and figured out below ways.
- Returning False from callback method passed(here callback_function) will stop datawatch on the zNode. But this way is not suitable for me as callback_function is handled by users and not in my hand.
- When process stops datawatch automatically gets killed. But I don't want to stop the process.
This is the hacky way I am using currently. There is a private member variable "_stopped" under datawatch class. I am setting it to true.
datawatch._stopped = True
Can someone please suggest better solution here. Thanks.