コード例 #1
0
async def app(arbiter):
    # Spawn a new actor
    calc = await Calculator.spawn(name='calc1')
    print(calc.name)
    # set value in the remote calculator
    await calc.set_value(46)
    # get value from the remote calculator
    value = await calc.get_value()
    print(value)

    # Stop the application
    arbiter.stop()
コード例 #2
0
async def app(arbiter):
    # Spawn a new actor
    proxy = await spawn(name='actor1')
    print(proxy.name)
    # Execute inner method in actor1
    result = await send(proxy, 'run', inner_method)
    print(result)

    await send(proxy, 'run', set_value, 10)
    value = await send(proxy, 'run', get_value)
    print(value)

    # Stop the application
    arbiter.stop()
コード例 #3
0
async def app(arbiter):
    # Spawn a new actor
    proxy = await spawn(name='actor1')
    print(proxy.name)

    count = 1
    startTimestamp = time.time()
    # Ping in actor1
    while count < 100000:
        count = await send(proxy, 'run', ping, count)
        #
        #await send(proxy, 'run', pingSimple)
        #count += 1

    print(time.time() - startTimestamp)

    # Stop the application
    arbiter.stop()