multiprocessing - Join two process by pid in Python -
i created 2 process using fork in python as
import os import sys pid = os.fork() if pid > 0: # set variable ( lets setting_a ) # lets execute os.waitpid(pid,0) else: pid = os.fork() if pid > 0: # set other variable ( lets setting_b ) # let execute os.waitpid(pid, 0) else: sys.exit(0) # common workflow problem:
lets assume script run setting_a takes 10 sec. while same script run setting_b takes 2 min. want run 2 instances of script 2 different setting in parallel. make sure parent process wait child finish, used os.waitpid(), made sequential execution. run first setting b , a. how can maintain parallelism , parent process wait until child process finish. tried searching join() process() class in python. there way can join these process pid without affecting change.
Comments
Post a Comment