This snippet works, but pytype gives [attribute-error]:
File "scrap.py", line 6, in worker_fn: No attribute '_identity' on multiprocessing.process.BaseProcess [attribute-error]
import multiprocessing
from multiprocessing import Pool
def worker_fn(x):
worker_idx = multiprocessing.current_process()._identity[0]
print(f"worker idx: {worker_idx}")
return x ** 2
with Pool(4) as pool:
results = pool.map(worker_fn, range(8))
print(results)
$ pytype --version
2021.09.09