the user can now output the benchmark results to a remote sql database accessed via ssh
note: as the production benchmarks are currently stored at IPR on a database server accessed via ssh, this allows iprbench to store its results to IPR benchmark database. work rleated to [https://bugzilla.ipr.univ-rennes.fr/show_bug.cgi?id=3958]
This commit is contained in:
parent
5337c41645
commit
86985d3de4
|
@ -1,7 +1,7 @@
|
|||
from typing import List
|
||||
import logging
|
||||
from pathlib import Path
|
||||
from cocluto.SimpaDbUtil import ISqlDatabaseBackend, SqliteDb, SqlTableField
|
||||
from cocluto.SimpaDbUtil import ISqlDatabaseBackend, SqliteDb, SqlTableField, SshAccessedMysqlDb
|
||||
from ..core import IResultsDb, IResultsTable, BenchmarkParamValues, IBenchmark, IResultsDbCreator, ResultsDbParams, BenchParam
|
||||
|
||||
|
||||
|
@ -63,11 +63,27 @@ class SqlResultsDb(IResultsDb):
|
|||
return table
|
||||
|
||||
|
||||
class SqlResultsDbCreator(IResultsDbCreator):
|
||||
class SqliteResultsDbCreator(IResultsDbCreator):
|
||||
|
||||
def __init__(self):
|
||||
super().__init__('sql-database')
|
||||
super().__init__('sqlite-database')
|
||||
|
||||
def create_resultsdb(self, resultsdb_config: ResultsDbParams) -> IResultsDb:
|
||||
sql_backend = SqliteDb(Path(resultsdb_config['sqlite_file_path']))
|
||||
return SqlResultsDb(sql_backend)
|
||||
|
||||
|
||||
class SqlServerResultsDbCreator(IResultsDbCreator):
|
||||
"""creates a SqlResultsDb instance configured using a RemoteMysqlDb backend
|
||||
"""
|
||||
def __init__(self):
|
||||
super().__init__('sqlserver-viassh-database')
|
||||
|
||||
def create_resultsdb(self, resultsdb_config: ResultsDbParams) -> IResultsDb:
|
||||
db_server_fqdn = resultsdb_config['db_server_fqdn']
|
||||
db_user = resultsdb_config['db_user']
|
||||
db_name = resultsdb_config['db_name']
|
||||
ssh_user = resultsdb_config['ssh_user']
|
||||
sql_backend = SshAccessedMysqlDb(db_server_fqdn, db_user, db_name, ssh_user)
|
||||
# sql_backend = RemoteMysqlDb(db_server_fqdn, db_user, db_name)
|
||||
return SqlResultsDb(sql_backend)
|
||||
|
|
|
@ -45,12 +45,31 @@ class IprBenchTestCase(unittest.TestCase):
|
|||
'num_cores': 2
|
||||
}
|
||||
resultsdb_params = {
|
||||
'type': 'sql-database',
|
||||
'type': 'sqlite-database',
|
||||
'sqlite_file_path': '/tmp/iprbench_results.sql'
|
||||
}
|
||||
command = f'iprbench-run --benchmark-id \'mamul1\' --config \'{json.dumps(config)}\' --results-dir {results_dir} --resultsdb-params \'{json.dumps(resultsdb_params)}\''
|
||||
subprocess.run(command, shell=True, check=True, executable='/bin/bash')
|
||||
|
||||
def test_sqlserver(self):
|
||||
logging.info('test_sqlserver')
|
||||
results_dir = Path('/tmp/mamul1_out')
|
||||
config = {
|
||||
'compiler_id': 'gfortran',
|
||||
'matrix_size': 1024,
|
||||
'num_loops': 10,
|
||||
'num_cores': 2
|
||||
}
|
||||
resultsdb_params = {
|
||||
'type': 'sqlserver-viassh-database',
|
||||
'db_server_fqdn': 'iprbenchsdb.ipr.univ-rennes1.fr',
|
||||
'db_user': 'test_iprbenchw',
|
||||
'db_name': 'test_iprbenchs',
|
||||
'ssh_user': 'test_iprbenchw'
|
||||
}
|
||||
command = f'iprbench-run --benchmark-id \'mamul1\' --config \'{json.dumps(config)}\' --results-dir {results_dir} --resultsdb-params \'{json.dumps(resultsdb_params)}\''
|
||||
subprocess.run(command, shell=True, check=True, executable='/bin/bash')
|
||||
|
||||
def test_iprbench_hibench(self):
|
||||
logging.info('test_iprbench_hibench')
|
||||
results_dir = Path('/tmp/hibench_out')
|
||||
|
|
Loading…
Reference in New Issue