Print

Print


Jacek,

   Two things. First of all, notice that in :

def createIt(zk, k, v):
   while True:
       try:
           print "create ", v
           zk.create(k, v, ephemeral=True, makepath=True)
       except:
           print "create failed"
           sleepABit()
       finally:
           print "create ok"
           return

your loop will only ever execute once (since the finally clause is executed no matter what). So you will return immediately if the creation fails (and yet still print “create ok”). You probably meant to use a try/except/else construct rather than try/except/finally?

Anyway, the consequence of that is that your code then admits the following sequence of events:

  Process A          | Process B
  ===================| ==================
1.                   | createIt (fails)
2. delete (success)  |
3. createIt (success)|
4.                   | delete (success)
5.                   | createIt (success)
6. get (value from B)|
7.                   | delete (success)
8. delete (failure)  |
                   
which seems to be what you are observing in your log (process A).

Either create needs to wait indefinitely for success, or you need to make sure not to delete k if you didn’t successfully create it.

Cheers,
Serge                                    



Use REPLY-ALL to reply to list

To unsubscribe from the QSERV-L list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=QSERV-L&A=1