File: pool-test.py

package info (click to toggle)
scalene 1.5.51-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 15,528 kB
  • sloc: cpp: 22,930; python: 13,403; javascript: 11,769; ansic: 817; makefile: 196; sh: 45
file content (16 lines) | stat: -rwxr-xr-x 357 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

import multiprocessing
# import logging
# log = multiprocessing.get_logger()
# log.setLevel(logging.DEBUG)
# log.addHandler(logging.StreamHandler())
from multiprocessing import Pool

def f(x):
    print("Start")
    return [i for i in range(1000000)]

if __name__ == '__main__':
    with Pool(5) as p:
        q = p.map(f, [1, 2, 3])
        print(len(q))