Re: How to reestablish a session

2010-11-19 Thread Gustavo Niemeyer
 is_unrecoverable() means exactly that: the session is toast. nothing you do
 will get it back.

Ok, I was wondering about what exactly was unrecoverable indeed.

 zookeeper_init is almost never used with a non-null client_id. the main use
 case for it is crash recovery. i've rarely seen it used, but you can start a
 session, save off the client_id to disk, create ephemerals etc., then if
 your program crashes, you can restart and recover the session and pick back
 up where you left off. in this case we don't worry about the session being
 closed by the previous instance of the program because it crashed. it's
 pretty tricky to use.

Understood.  I agree this is a pretty unique case, and a very hard one
to get right by itself (how to get the app in the proper state to
receive watches after the whole application has crashed?).

-- 
Gustavo Niemeyer
http://niemeyer.net
http://niemeyer.net/blog
http://niemeyer.net/twitter


Re: txzookeeper - a twisted python client for zookeeper

2010-11-19 Thread Mahadev Konar
Nice.
Any chance of putting it back in zk?

Would be useful.

Thanks
mahadev


On 11/18/10 1:17 PM, Kapil Thangavelu kapil.f...@gmail.com wrote:

At canonical we've been using zookeeper heavily in the development of a new
project (ensemble) as noted by gustavo.

I just wanted to give a quick overview of the client library we're using for
it. Its called txzookeeper, its got 100% test coverage, and implements
various queue, lock, and utilities in addition to wrapping the standard zk
interface. Its based on the twisted async networking framework for python,
and obviates the need to use threads within the application, as all watches
and result callbacks are invoked in the main app thread. This makes
structuring the code signficantly simpler imo than having to deal with
threads in the application, but of course tastes may vary ;-).

Source code is here : http://launchpad.net/txzookeeper

comments and feedback welcome.

cheers,

Kapil