import taskloaf as tsk

N = 4


async def f():
    gang = await tsk.ctx().wait_for_workers(N)
    await tsk.task(lambda: print("hI"), to=gang[N - 2])
    return 123


if __name__ == "__main__":
    for i in range(2):
        r = tsk.zmq_run(cfg=tsk.Cfg(n_workers=N), f=f)
        print(r)
        assert r == 123

173b0752a654c4122795d2f90f687664f0cd2320
<mask token>

<mask token>


async def f():
    gang = await tsk.ctx().wait_for_workers(N)
    await tsk.task(lambda : print('hI'), to=gang[N - 2])
    return 123


if __name__ == '__main__':
    for i in range(2):
        r = tsk.zmq_run(cfg=tsk.Cfg(n_workers=N), f=f)
        print(r)
        assert r == 123

<mask token>
N = 4


async def f():
    gang = await tsk.ctx().wait_for_workers(N)
    await tsk.task(lambda : print('hI'), to=gang[N - 2])
    return 123


if __name__ == '__main__':
    for i in range(2):
        r = tsk.zmq_run(cfg=tsk.Cfg(n_workers=N), f=f)
        print(r)
        assert r == 123

import taskloaf as tsk
N = 4


async def f():
    gang = await tsk.ctx().wait_for_workers(N)
    await tsk.task(lambda : print('hI'), to=gang[N - 2])
    return 123


if __name__ == '__main__':
    for i in range(2):
        r = tsk.zmq_run(cfg=tsk.Cfg(n_workers=N), f=f)
        print(r)
        assert r == 123

import taskloaf as tsk

N = 4


async def f():
    gang = await tsk.ctx().wait_for_workers(N)
    await tsk.task(lambda: print("hI"), to=gang[N - 2])
    return 123


if __name__ == "__main__":
    for i in range(2):
        r = tsk.zmq_run(cfg=tsk.Cfg(n_workers=N), f=f)
        print(r)
        assert r == 123
