From ccb964bb446fa37aba1ea089eaea6cb40f0ca339 Mon Sep 17 00:00:00 2001 From: Guillaume Raffy Date: Wed, 27 Nov 2024 14:10:07 +0100 Subject: [PATCH] v0.0.16 - added the output_url autoparameter. It allows to automatically register the location of the benchmark output files in case they're needed and preserved. This will help traceability work related to [https://bugzilla.ipr.univ-rennes.fr/show_bug.cgi?id=3958] --- iprbench/autoparams.py | 16 ++++++++++++++-- iprbench/main.py | 3 ++- iprbench/version.py | 2 +- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/iprbench/autoparams.py b/iprbench/autoparams.py index 980a1eb..3f7274f 100644 --- a/iprbench/autoparams.py +++ b/iprbench/autoparams.py @@ -1,11 +1,12 @@ from datetime import datetime -from .core import IAutoParam, BenchParam, BenchParamType -from .version import __version__ as iprbench_version import socket import subprocess import re import os import pwd +from pathlib import Path +from .core import IAutoParam, BenchParam, BenchParamType +from .version import __version__ as iprbench_version class MeasurementTime(IAutoParam): @@ -131,3 +132,14 @@ class CpuModel(IAutoParam): cpu_model = match['cpu_model'] # print(cpu_model) return CpuModel.model_name_to_cpu_model_id(cpu_model) + + +class OutputUrl(IAutoParam): + + def __init__(self, output_dir: Path): + bench_param = BenchParam('output_url', BenchParam.Type.PARAM_TYPE_STRING, 'the location of the output files of this benchmarks') + super().__init__(bench_param) + self.output_url = f'file://{socket.getfqdn()}{output_dir.absolute()}' + + def get_value(self) -> BenchParamType: + return self.output_url diff --git a/iprbench/main.py b/iprbench/main.py index da7cf52..222fa96 100644 --- a/iprbench/main.py +++ b/iprbench/main.py @@ -10,7 +10,7 @@ from .benchmarks.mamul1 import MaMul1 from .resultsdb.tsvresultsdb import TsvResultsDbCreator from .resultsdb.sqlresultsdb import SqliteResultsDbCreator, SqlServerResultsDbCreator from .util import Singleton -from .autoparams import MeasurementTime, HostFqdn, User, NumCpus, CpuModel, IprBenchVersion, HostId +from .autoparams import MeasurementTime, HostFqdn, User, NumCpus, CpuModel, IprBenchVersion, HostId, OutputUrl class BenchmarkFactory(metaclass=Singleton): @@ -62,6 +62,7 @@ def main(): results_db.add_auto_param(User()) results_db.add_auto_param(NumCpus()) results_db.add_auto_param(CpuModel()) + results_db.add_auto_param(OutputUrl(args.results_dir)) results_db.add_common_param(BenchParam('launcher', BenchParam.Type.PARAM_TYPE_STRING, description='what triggered the benchmark (eg "alambix.job.12345", or "manual")')) target_host = { diff --git a/iprbench/version.py b/iprbench/version.py index 8ecd910..19c6940 100644 --- a/iprbench/version.py +++ b/iprbench/version.py @@ -1 +1 @@ -__version__ = '0.0.15' +__version__ = '0.0.16'