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()
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()
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()
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()