Run all configs without log parsing from simapp (#1)

This commit is contained in:
gusto 2023-08-16 11:11:16 +03:00 committed by GitHub
parent ad86cd0495
commit 02a82a421b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 13 deletions

View File

@ -4,19 +4,9 @@ import os
import time import time
def run_simulation(command): def run_simulation(command):
# TODO: Graceful shutdown in simulation doesn't work yet, remove the ouput filtering once implemented. start_time = time.time()
search_string = "ALL DONE" process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, bufsize=1, universal_newlines=True)
process.communicate()
with subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, bufsize=1, universal_newlines=True) as process:
for line in iter(process.stdout.readline, ''):
if search_string in line:
# TODO: In simulation, subscriber will drop all remaining unpersisted records when the process
# is terminated, add some delay for filesystem to catch up with writing the output data.
time.sleep(5)
process.terminate()
return
process.communicate() # wait for the process to finish if it hasn't yet
def run_simulations(configs_path): def run_simulations(configs_path):
for filename in os.listdir(configs_path): for filename in os.listdir(configs_path):