-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path05MaxResponse.py
34 lines (27 loc) · 1.05 KB
/
05MaxResponse.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import multiprocessing
import subprocess
import constant as constant
def run_script(script_args):
script_name, args = script_args
# Construct the command with the script and arguments
command = ['python', script_name] + args
subprocess.run(command, check=True)
def main():
# List of tuples where each tuple contains a script name and a list of arguments
scripts_with_args = [
('MaxResponse.py', ['P0']),
('MaxResponse.py', ['P1']),
('MaxResponse.py', ['P2']),
('MaxResponse.py', ['P3']),
('MaxResponse.py', ['P4'])
]
# Create a pool of processes, each running one of the scripts
with multiprocessing.Pool(processes=len(scripts_with_args)) as pool:
pool.map(run_script, scripts_with_args)
# After all scripts have finished, stitch them together
exp=str(constant.parentFolder)
exp ='"'+ exp + '"'
command2 = "python StitchFiles.py " + exp + ' "MaxResponse"'
subprocess.run(command2, check=True)
if __name__ == '__main__':
main()