Lines Matching refs:pool
43 print('Creating pool with %d processes\n' % PROCESSES)
45 with multiprocessing.Pool(PROCESSES) as pool:
53 results = [pool.apply_async(calculate, t) for t in TASKS]
54 imap_it = pool.imap(calculatestar, TASKS)
55 imap_unordered_it = pool.imap_unordered(calculatestar, TASKS)
57 print('Ordered results using pool.apply_async():')
62 print('Ordered results using pool.imap():')
67 print('Unordered results using pool.imap_unordered():')
72 print('Ordered results using pool.map() --- will block till complete:')
73 for x in pool.map(calculatestar, TASKS):
84 print(pool.apply(f, (5,)))
86 print('\tGot ZeroDivisionError as expected from pool.apply()')
91 print(pool.map(f, list(range(10))))
93 print('\tGot ZeroDivisionError as expected from pool.map()')
98 print(list(pool.imap(f, list(range(10)))))
100 print('\tGot ZeroDivisionError as expected from list(pool.imap())')
104 it = pool.imap(f, list(range(10)))
126 res = pool.apply_async(calculate, TASKS[0])
138 it = pool.imap(calculatestar, TASKS)