|
31 | 31 | import re
|
32 | 32 | import json
|
33 | 33 | import datetime
|
| 34 | +import time |
34 | 35 | from glob import glob
|
35 | 36 | from pathlib import Path
|
36 | 37 | from typing import List, Optional
|
|
42 | 43 | from mx_benchmark import BenchmarkSuite, DataPoints, Rule, Vm, SingleBenchmarkExecutionContext
|
43 | 44 | from mx._impl.mx_codeowners import _load_toml_from_fd
|
44 | 45 | from mx_sdk_benchmark import SUCCESSFUL_STAGE_PATTERNS, parse_prefixed_args
|
45 |
| -from mx_util import StageName, Layer |
| 46 | +from mx_util import Stage, StageName, Layer |
46 | 47 |
|
47 | 48 | _suite = mx.suite("substratevm")
|
48 | 49 |
|
@@ -661,7 +662,13 @@ def _gos_scenarios_dir(self) -> Path:
|
661 | 662 |
|
662 | 663 | def _vm_benchmarks_graalos_dir(self) -> Path:
|
663 | 664 | """Returns the path to the directory containing the applications that comprise the scenarios."""
|
664 |
| - return Path(mx.primary_suite().vc_dir) / "vm-benchmarks" / "graalos" |
| 665 | + vm_enterprise_suite = next(filter(lambda suite: suite.name == "vm-enterprise", mx.suites()), None) |
| 666 | + if vm_enterprise_suite is None: |
| 667 | + raise ValueError(f"Failed to find the vm-enterprise suite on which {self.__class__.__name__} relies on for locating the graal-enterpise repository!") |
| 668 | + vm_benchmarks_graalos_dir = Path(vm_enterprise_suite.vc_dir) / "vm-benchmarks" / "graalos" |
| 669 | + if not vm_benchmarks_graalos_dir.is_dir(): |
| 670 | + raise ValueError(f"Failed to locate the benchmarks directory! No directory exists with path '{vm_benchmarks_graalos_dir}'!") |
| 671 | + return vm_benchmarks_graalos_dir |
665 | 672 |
|
666 | 673 | def _app_source_dir(self, app: str) -> Path:
|
667 | 674 | """Returns the path to the source code directory of the application."""
|
@@ -891,6 +898,17 @@ def runAndReturnStdOut(self, benchmarks, bmSuiteArgs):
|
891 | 898 | self._ensure_dataplane_scenario_can_run()
|
892 | 899 | return retcode, out, dims
|
893 | 900 |
|
| 901 | + def run_stage(self, vm, stage: Stage, command, out, err, cwd, nonZeroIsFatal): |
| 902 | + retcode = super().run_stage(vm, stage, command, out, err, cwd, nonZeroIsFatal) |
| 903 | + if stage.stage_name == StageName.INSTRUMENT_RUN: |
| 904 | + # GraalOS Load Tester can exit before the app images have shutdown and generated the profile |
| 905 | + wait_for = 10 |
| 906 | + sleep_duration = 0.5 |
| 907 | + while wait_for >= 0 and not vm.config.profile_path.is_file(): |
| 908 | + time.sleep(sleep_duration) |
| 909 | + wait_for -= sleep_duration |
| 910 | + return retcode |
| 911 | + |
894 | 912 | def _check_if_dataplane_scenario(self) -> bool:
|
895 | 913 | """Returns whether the scenario uses 'dataplane' deployment."""
|
896 | 914 | return self._get_scenario_deployment() == "dataplane"
|
@@ -993,9 +1011,12 @@ def produceHarnessCommand(self, cmd: List[str], suite: BenchmarkSuite) -> List[s
|
993 | 1011 | app_cmd += parse_prefixed_args("-Dnative-image.benchmark.extra-run-arg=", bmSuiteArgs)
|
994 | 1012 |
|
995 | 1013 | gos_cmd = [suite._gos_scenario_command(), f"{scenario}", "--local-load-testers", "--skip-upload"]
|
| 1014 | + output_dir = suite.execution_context.virtual_machine.config.output_dir |
| 1015 | + gos_cmd += ["-p", f"extra_graalhost_dir_mounts='{output_dir}'"] |
996 | 1016 | timestamp = datetime.datetime.now().strftime("%Y-%m-%d-%H-%M-%S")
|
997 | 1017 | gos_log_file_name = f"{timestamp}-gos-out.log"
|
998 |
| - gos_cmd += ["--log-to", f"stdout,file:{gos_log_file_name}"] |
| 1018 | + gos_log_file_path = output_dir / gos_log_file_name |
| 1019 | + gos_cmd += ["--log-to", f"stdout,file:{gos_log_file_path}"] |
999 | 1020 | if suite.execution_context.virtual_machine.graalhost_graalos:
|
1000 | 1021 | gos_cmd += ["-p", f"deployment='nginx-tinyinit-graalhost'"]
|
1001 | 1022 | app_cmd_str = " ".join(app_cmd)
|
|
0 commit comments