Ejemplo n.º 1
0
    def func():
        callbacks = []
        for j in xrange(options.znode_count):
            cb = zkclient.CreateCallback()
            cb.cv.acquire()
            s.acreate(child_path(j), cb, data, zookeeper.EPHEMERAL)
            callbacks.append(cb)

        for j, cb in enumerate(callbacks):
            cb.waitForSuccess()
            if cb.path != child_path(j):
                raise SmokeError("invalid path %s for operation %d on handle %d" %
                                 (cb.path, j, cb.handle))
Ejemplo n.º 2
0
def create_asynchronous_latency_test(zd):
    # create znode_count znodes (perm)

    global SESSIONS_NUM
    callbacks = []
    for j in xrange(options.znode_count / SESSIONS_NUM):
        cb = zkclient.CreateCallback()
        cb.cv.acquire()
        zd.session.acreate(child_path(j, zd.id), cb, zd.data)
        callbacks.append(cb)

    count = 0
    for j, cb in enumerate(callbacks):
        cb.waitForSuccess()
        #print(child_path(j, zd.id))
        if cb.path != child_path(j, zd.id):
            raise SmokeError("invalid path %s for operation %d on handle %d" %
                             (cb.path, j, cb.handle))
        count += 1
        if time.time() - zd.startTime >= 10:
            break
    return count