Example #1
0
    def func():
        callbacks = []
        for j in xrange(options.znode_count):
            cb = zkclient.SetCallback()
            cb.cv.acquire()
            s.aset(child_path(j), cb, data)
            callbacks.append(cb)

        for cb in callbacks:
            cb.waitForSuccess()
Example #2
0
def set_asynchronous_latency_test(zd):
    # create znode_count znodes (perm)
    global SESSIONS_NUM
    callbacks = []
    for j in xrange(options.znode_count / SESSIONS_NUM):
        cb = zkclient.SetCallback()
        cb.cv.acquire()
        zd.session.aset(child_path(j, zd.id), cb, zd.data)
        callbacks.append(cb)

    count = 0
    for cb in callbacks:
        cb.waitForSuccess()
        count += 1
        if time.time() - zd.startTime >= 10:
            break
    return count