Spaces:
Sleeping
Sleeping
Oscar Wang
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -166,7 +166,6 @@ import os
|
|
166 |
import tempfile
|
167 |
import subprocess
|
168 |
from mpi4py import MPI
|
169 |
-
|
170 |
def target_function(script_path, folder_path):
|
171 |
output_log = tempfile.TemporaryFile(mode='w+t')
|
172 |
try:
|
@@ -178,12 +177,10 @@ def target_function(script_path, folder_path):
|
|
178 |
finally:
|
179 |
output_log.close()
|
180 |
return log_output
|
181 |
-
|
182 |
def run_script(script_path, folder_path):
|
183 |
comm = MPI.COMM_WORLD
|
184 |
rank = comm.Get_rank()
|
185 |
size = comm.Get_size()
|
186 |
-
|
187 |
if rank == 0:
|
188 |
# Master process
|
189 |
log_outputs = []
|
@@ -196,7 +193,6 @@ def run_script(script_path, folder_path):
|
|
196 |
# Worker process
|
197 |
log_output = target_function(script_path, folder_path)
|
198 |
comm.send(log_output, dest=0, tag=11)
|
199 |
-
|
200 |
if __name__ == "__main__":
|
201 |
run_script('{script_path}', '{folder_path}')
|
202 |
""")
|
|
|
166 |
import tempfile
|
167 |
import subprocess
|
168 |
from mpi4py import MPI
|
|
|
169 |
def target_function(script_path, folder_path):
|
170 |
output_log = tempfile.TemporaryFile(mode='w+t')
|
171 |
try:
|
|
|
177 |
finally:
|
178 |
output_log.close()
|
179 |
return log_output
|
|
|
180 |
def run_script(script_path, folder_path):
|
181 |
comm = MPI.COMM_WORLD
|
182 |
rank = comm.Get_rank()
|
183 |
size = comm.Get_size()
|
|
|
184 |
if rank == 0:
|
185 |
# Master process
|
186 |
log_outputs = []
|
|
|
193 |
# Worker process
|
194 |
log_output = target_function(script_path, folder_path)
|
195 |
comm.send(log_output, dest=0, tag=11)
|
|
|
196 |
if __name__ == "__main__":
|
197 |
run_script('{script_path}', '{folder_path}')
|
198 |
""")
|