Answers for "Running python script in parallel"

0

Running python script in parallel

import multiprocessing
import os                                                               
 
# Creating the tuple of all the processes
all_processes = ('script_A.py', 'script_B.py', 'script_C.py', 'script_D.py')                                    
                                                  
# This block of code enables us to call the script from command line.                                                                                
def execute(process):                                                             
    os.system(f'python {process}')                                       
                                                                                
                                                                                
process_pool = multiprocessing.Pool(processes = 4)                                                        
process_pool.map(execute, all_processes)
Posted by: Guest on September-14-2021

Code answers related to "Running python script in parallel"

Python Answers by Framework

Browse Popular Code Answers by Language