I am trying to figure a way to get the number of processes directly from an instance of multiprocessing.Pool
class in Python.. Is there a way to do it?
The documentation doesn't show anything related.
Thanks
I am trying to figure a way to get the number of processes directly from an instance of multiprocessing.Pool
class in Python.. Is there a way to do it?
The documentation doesn't show anything related.
Thanks
You can use _processes
attribute:
>>> import multiprocessing
>>> pool = multiprocessing.Pool()
>>> pool._processes
8
The return value is same for multiprocessing.cpu_count()
unless you specified process count when creating Pool
object.
>>> multiprocessing.cpu_count()
8