Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

get current worker id multiprocessing

import multiprocessing
  
def twos_multiple(x):        
    proc = multiprocessing.Process()
    curr_proc = multiprocessing.current_process()
    print('current process:', curr_proc.name, curr_proc._identity)
    print('created process:', proc.name, proc._identity)
    return x * 2
  
pro = multiprocessing.Pool()
  
print(pro.map(twos_multiple, range(10)))
Comment

PREVIOUS NEXT
Code Example
Python :: Replace u00a0 
Python :: start a webservice quickly using python2.7 
Python :: python enumerate in list comprehension with if statement 
Python :: spark group by alias 
Python :: how to reverse a dictionary in python 
Python :: implementing a bubble sort in python 
Python :: tar: Exiting with failure status due to previous errors 
Python :: semaphore example in python 
Python :: django query or condition for query parameters 
Python :: Python Print Variable Using the + operator to join variables 
Python :: django send_mail not working in testcase 
Python :: set defualt to none django 
Python :: pandas 3d tutorail pythoin 
Python :: Mastermind 
Python :: Kivy button on press call function with arguments 
Python :: scrapy pass string as html 
Python :: python group groupe of 2 
Python :: Cget subassembly civid3d 
Python :: python discover methods of object/module 
Python :: python3 main.py 
Python :: pandas return indices that match 
Python :: stop animation matplotlib 
Python :: round up 
Python :: Find & set values in pandas Dataframe 
Python :: fine tune huggingface model pytorch 
Python :: df sum 
Python :: python range for loop 
Python :: python 1.0 
Python :: matplotlib show image black and white 
Python :: change value in dataframe 
ADD CONTENT
Topic
Content
Source link
Name
5+5 =