示例#1
0
def main(args):
    operation=args[1]
    tupletype=args[2]
    level=args[3]

    print('operation: %s' % operation)
    print('tupletype: %s' % tupletype)
    print('level:     %s' % level)

    tg = None
    if tupletype == "null":
        def _tg():
            while True:
                yield (None, None)
        tg = _tg()
    elif tupletype == "int":
        def _tg():
            while True:
                yield (randint(), randint())
        tg = _tg()
    elif tupletype == "string":
        def _tg():
            while True:
                yield (randstring(32), randstring(32))
        tg = _tg()
    elif tupletype == "doublearray":
        def _tg():
            while True:
                yield (randdoublearray(32), randdoublearray(32))
        tg = _tg()
    elif tupletype == "doublearrayxl":
        def _tg():
            while True:
                yield (randdoublearray(256), randdoublearray(256))
        tg = _tg()
    elif tupletype == "doublearrayxxl":
        def _tg():
            while True:
                yield (randdoublearray(2048), randdoublearray(2048))
        tg = _tg()
    else:
        raise Exception("unsupported tupletype %s", tupletype)

    print("connecting to space")
    space = pyspaces.PySpaceXMLRPCClient('http://localhost:10000')

    if operation == "put":
        experiment_put(space, tg, level)
    elif operation == "take":
        experiment_take(space, tg, level)
    else:
        raise Exception("unsupported operation %s", operation)
示例#2
0
def main():
    p = pyspaces.PySpaceXMLRPCClient('http://localhost:10000')
    p.put((None,))
def main():
    p = pyspaces.PySpaceXMLRPCClient('http://localhost:10000')
    t = ('hello', 'world')
    print('producing tuple: %s' % str(t))
    p.put(t)
示例#4
0
def pyspace(server, hostname, port):
    return pyspaces.PySpaceXMLRPCClient('http://%s:%d' % (hostname, port))
示例#5
0
def main():
    p = pyspaces.PySpaceXMLRPCClient('http://localhost:10000')
    print('consuming tuple: %s' % str(p.take(('hello', None))))