Esempio n. 1
0
def scheduler_and_workers(n=2):
    s = Scheduler()
    workers = [Worker(s.address_to_workers) for i in range(n)]
    try:
        yield s, workers
    finally:
        s.close()
        for w in workers:
            w.close()
Esempio n. 2
0
def scheduler_and_workers(n=2):
    s = Scheduler()
    workers = [Worker(s.address_to_workers) for i in range(n)]
    try:
        yield s, workers
    finally:
        s.close()
        for w in workers:
            w.close()
Esempio n. 3
0
def scheduler_and_workers(n=2):
    s = Scheduler(hostname='127.0.0.1')
    workers = [Worker(s.address_to_workers, hostname='127.0.0.1') for i in range(n)]
    while len(s.workers) < n:
        sleep(1e-6)
    try:
        yield s, workers
    finally:
        s.close()
        for w in workers:
            w.close()
Esempio n. 4
0
def scheduler_and_workers(n=2):
    s = Scheduler()
    workers = [Worker(s.address_to_workers) for i in range(n)]
    while len(s.workers) < n:
        sleep(0.01)
    try:
        yield s, workers
    finally:
        s.close()
        for w in workers:
            w.close()
Esempio n. 5
0
def scheduler_and_workers(n=2):
    s = Scheduler(hostname='127.0.0.1')
    workers = [
        Worker(s.address_to_workers, hostname='127.0.0.1', nthreads=10)
        for i in range(n)
    ]
    while len(s.workers) < n:
        sleep(1e-6)
    try:
        yield s, workers
    finally:
        for w in workers:
            w.close()
        s.close()