Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

index in the pool python

import os
from multiprocessing import current_process, Pool


def x(a):
    p = current_process()
    print('process counter:', p._identity[0], 'pid:', os.getpid())


if __name__ == '__main__':
    with Pool(2) as p:
        r = p.map(x, range(4))
    p.join()
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #index #pool #python
ADD COMMENT
Topic
Name
3+8 =