Return-Path: X-Original-To: apmail-zookeeper-user-archive@www.apache.org Delivered-To: apmail-zookeeper-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 588E6C081 for ; Fri, 25 May 2012 13:44:25 +0000 (UTC) Received: (qmail 87921 invoked by uid 500); 25 May 2012 13:44:24 -0000 Delivered-To: apmail-zookeeper-user-archive@zookeeper.apache.org Received: (qmail 87885 invoked by uid 500); 25 May 2012 13:44:24 -0000 Mailing-List: contact user-help@zookeeper.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@zookeeper.apache.org Delivered-To: mailing list user@zookeeper.apache.org Received: (qmail 87877 invoked by uid 99); 25 May 2012 13:44:24 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 May 2012 13:44:24 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of loki.davison@gmail.com designates 209.85.217.170 as permitted sender) Received: from [209.85.217.170] (HELO mail-lb0-f170.google.com) (209.85.217.170) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 May 2012 13:44:19 +0000 Received: by lbgc1 with SMTP id c1so645911lbg.15 for ; Fri, 25 May 2012 06:43:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=ONl+1UmraQ6ZsrAwDcO5sC7Sd5HdhTtoIVNBtA8t43k=; b=nb18Cem3exI7gINwblm5FhlqjkvDxJa7YMzqi70xZ6y6LxFEq5J3Ii6tjMNzACZhKC 7be9+hmHv+NniYRJxVzIsPzbIwDRNqqtbwaUKgMh1YNifj/QFmG4KGSRimgpeo3ebZ23 5PwPko5EYoIPFEoz+eiVHEqXVby4RPIjSbBoVfl/+VAKce9Tk0WvIP9eBIN7uP0YWScy rHjxrKWDEDnaiEiJLEXuPsr5nVij0sS3pQ5T2SfCr38LjYIz9Fw3QhHHUH3BD8/a28cv UMlcnJAPutAJlEELiP3nUmU8MT4tcXaBftEaE+MkEMEvXN0MmjnJM6yERkZtCE883pON wYng== MIME-Version: 1.0 Received: by 10.112.23.196 with SMTP id o4mr1567750lbf.49.1337953438081; Fri, 25 May 2012 06:43:58 -0700 (PDT) Received: by 10.112.8.106 with HTTP; Fri, 25 May 2012 06:43:58 -0700 (PDT) Date: Fri, 25 May 2012 23:43:58 +1000 Message-ID: Subject: gevent, python and zookeeper. From: Loki Davison To: user@zookeeper.apache.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org Hi all, I'm attempting to use zookeeper basically as a name server and to a lesser extent as a lock server. However I'm having trouble getting any of the python bindings to work with gevent and do what i require. I first implemented everything using zktools and zc.zk, which looked well documented and thought out and it all works well with threads but breaks with gevent. I'm not sure how to implement the solution from resumelb with monkey patch all (which i need to do for redis). I've tried to use kazoo but the watches are only fired once. If I attempt to reregister the watcher in the call back it block and never returns. I suspect i'm doing something incorrectly with kazoo. Has anyone successfully used watches with kazoo or can suggest a solution? The use case in question is a failover connection pool for redis, that also does leader election (redis has a single master), the code is on github using zktools: https://github.com/loki42/failover_connection Kazoo test case: import kazoo a = kazoo.KazooClient("localhost:2181") a.connect() import kazoo.recipe.party as party p = party.ZooParty(a, "/redis/providers", "192.168.0.122:6380") p.join() p.get_participant_count() def w_b(e): print "### watcher called" ## a.get_children("/redis/providers", w_b) ## explodes if i try this, otherwise called once. return True a.get_children("/redis/providers", w_b) Thanks, Loki