‘multiprocessing.active_children()’
method returns number of active children for current process.
import multiprocessing import time def process_data(): print("Started processing data") time.sleep(3) print("Finished processing") if(__name__=="__main__"): process1 = multiprocessing.Process(target=process_data) process2 = multiprocessing.Process(target=process_data) process1.start() process2.start() list = multiprocessing.active_childern() for proc in list : print(proc)
No comments:
Post a Comment