diff --git a/iprbench/autoparams.py b/iprbench/autoparams.py index 03ea196..980a1eb 100644 --- a/iprbench/autoparams.py +++ b/iprbench/autoparams.py @@ -4,6 +4,8 @@ from .version import __version__ as iprbench_version import socket import subprocess import re +import os +import pwd class MeasurementTime(IAutoParam): @@ -50,6 +52,16 @@ class HostFqdn(IAutoParam): return socket.getfqdn() +class User(IAutoParam): + + def __init__(self): + bench_param = BenchParam('user', BenchParam.Type.PARAM_TYPE_STRING, 'the user that triggered the benchmark (eg "root")') + super().__init__(bench_param) + + def get_value(self) -> BenchParamType: + return pwd.getpwuid(os.getuid())[0] + + class NumCpus(IAutoParam): def __init__(self): diff --git a/test/test_benchmarks.py b/test/test_benchmarks.py index 06fee2e..03320c6 100644 --- a/test/test_benchmarks.py +++ b/test/test_benchmarks.py @@ -43,7 +43,8 @@ class BenchmarksTestCase(unittest.TestCase): 'blas_library': ':', 'matrix_size': 1024, 'num_loops': 10, - 'num_cores': 2 + 'num_cores': 2, + 'launcher': 'iprbench.unittest', } test_benchmark(benchmark_id, benchmark_config, self.results_root_dir) diff --git a/test/test_clusterbench.py b/test/test_clusterbench.py index 323763b..89b9cb3 100644 --- a/test/test_clusterbench.py +++ b/test/test_clusterbench.py @@ -40,6 +40,7 @@ class ClusterBenchTestCase(unittest.TestCase): 'blas_library': ':', 'matrix_size': 1024, 'num_loops': 10, + 'launcher': 'iprbench.unittest', } test_clusterbench_submit_with_benchmark(benchmark_id, benchmark_config, self.results_root_dir) diff --git a/test/test_resultsdb.py b/test/test_resultsdb.py index 513e3a0..20325e8 100644 --- a/test/test_resultsdb.py +++ b/test/test_resultsdb.py @@ -24,7 +24,8 @@ def test_resultsdb(resultsdb_params: ResultsDbParams, results_root_path: Path): 'blas_library': ':', 'matrix_size': 1024, 'num_loops': 10, - 'num_cores': 2 + 'num_cores': 2, + 'launcher': 'iprbench.unittest', } command = f'iprbench-run --benchmark-id \'{benchmark_id}\' --config \'{json.dumps(benchmark_config)}\' --results-dir {results_dir} --resultsdb-params \'{json.dumps(resultsdb_params)}\'' subprocess.run(command, shell=True, check=True, executable='/bin/bash')