Commit 52b18a14 authored by Benedikt Kleinmeier's avatar Benedikt Kleinmeier
Browse files

In "run_vadere_console_with_all_scenario_files.py", print runtime (in seconds)...

In "run_vadere_console_with_all_scenario_files.py", print runtime (in seconds) for each scenario file.
parent 24dc2eb0
Pipeline #63742 failed with stages
in 4 minutes and 6 seconds
......@@ -13,6 +13,7 @@ import os
import re
import shutil
import subprocess
import time
def find_scenario_files(path="VadereModelTests"):
scenario_search_pattern = "*.scenario"
......@@ -45,13 +46,21 @@ def run_scenario_files_with_vadere_console(scenario_files, vadere_console="Vader
for i, scenario_file in enumerate(scenario_files):
print("Running scenario file ({}/{}): {}".format(i + 1, total_scenario_files, scenario_file))
# Measure wall time and not cpu because it is the easiest.
wall_time_start = time.time()
# Use timout feature, check return value and capture stdout/stderr to a PIPE (use completed_process.stdout to get it).
completed_process = subprocess.run(args=["java", "-enableassertions", "-jar", vadere_console, scenario_file, output_dir],
timeout=scenario_timeout_in_sec,
check=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
print("Finished scenario file: {}".format(scenario_file))
wall_time_end = time.time()
wall_time_delta = wall_time_end - wall_time_start
print("Finished scenario file ({:.1f} s): {}".format(wall_time_delta, scenario_file))
if os.path.exists(output_dir):
shutil.rmtree(output_dir)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment