Commit 9bb6f7d2 authored by Florian Fischer's avatar Florian Fischer
Browse files

support both client implementations

parent eeb4133f
......@@ -9,12 +9,15 @@ from typing import Mapping, Sequence, Union
from .benchresult import BenchResult
from .coordinator import Coordinator
from .globalvars import CLIENT_DIR, HOSTNAME, KILL_CMD, TERMINATION_TIME
from .globalvars import EMPER_CLIENT_DIR, CLIENTS_DIR, HOSTNAME, KILL_CMD, TERMINATION_TIME
from .util import cmd_run, prepare_env
log = logging.getLogger(__name__)
CLIENT_EXE = f'{CLIENT_DIR}/build/apps/echoclient'
CLIENT_IMPLEMENTATIONS = {
'emper': f'{EMPER_CLIENT_DIR}/build/apps/echoclient',
'io_uring': f'{CLIENTS_DIR}/io_uring/build/client',
}
CLIENT_CSV = '{arg_prefix}.ini'
CLIENT_OUT = '{arg_prefix}.out'
......@@ -23,8 +26,7 @@ CLIENT_ERR = '{arg_prefix}.err'
CLIENT_TIMEOUT_FACTOR = 2
CLIENT_DEFAULT_TERMINATION = ('time', 60)
CLIENT_CMD = (f'{CLIENT_EXE} -c {{cons}} -s {{size}} {{termination_flag}}'
' -a {host} -f {outfile} --no-quit')
CLIENT_CMD = '{exe} -c {cons} -s {size} {termination_flag} -a {host} -f {outfile} --no-quit'
def purge_empty_files(files: Sequence[Union[str, Path]]):
......@@ -42,7 +44,8 @@ def run_clients(run: int,
termination=None,
remote_cmd=None,
hosts=None,
env=None) -> BenchResult:
env=None,
implementation='emper') -> BenchResult:
"""Run one or multiple local or remote clients fro args"""
arg_prefix_template = f'{run}.{{{"}.{".join(sorted(args.keys()))}}}'
......@@ -70,7 +73,8 @@ def run_clients(run: int,
csv = result_dir / client_csv
if not hosts:
cmd = CLIENT_CMD.format(host=server_host,
cmd = CLIENT_CMD.format(exe=CLIENT_IMPLEMENTATIONS[implementation],
host=server_host,
outfile=csv,
termination_flag=termination_flag,
**args,
......
......@@ -3,11 +3,11 @@
import subprocess
import logging
from .globalvars import CLIENT_DIR
from .globalvars import EMPER_CLIENT_DIR
log = logging.getLogger(__name__)
COORDINATOR_EXE = f'{CLIENT_DIR}/build/apps/coordinator'
COORDINATOR_EXE = f'{EMPER_CLIENT_DIR}/build/apps/coordinator'
class Coordinator(subprocess.Popen):
......
......@@ -34,8 +34,8 @@ import subprocess
import sys
from typing import Dict, List, Sequence, Union
from .client import CLIENT_DIR, CLIENT_EXE
from .globalvars import ROOT_DIR
from .client import CLIENT_IMPLEMENTATIONS
from .globalvars import ROOT_DIR, EMPER_CLIENT_DIR
from .util import cmd_run, prepare_env
log = logging.getLogger(__name__)
......@@ -393,13 +393,13 @@ def prepare_client(data_dir: Path):
print(f'client_commit: {client_checkout}', file=desc_file)
# print(f'client_cmd: {CLIENT_CMD}', file=desc_file)
if Path(f'{CLIENT_EXE}').exists():
if Path(f'{CLIENT_IMPLEMENTATIONS["emper"]}').exists():
return
print("Preparing the client ...")
if not CLIENT_DIR.exists():
checkout_worktree(CLIENT_DIR, client_checkout)
build_emper(CLIENT_DIR)
if not EMPER_CLIENT_DIR.exists():
checkout_worktree(EMPER_CLIENT_DIR, client_checkout)
build_emper(EMPER_CLIENT_DIR)
def repo_fetch():
......
......@@ -5,7 +5,8 @@ import platform
from pathlib import Path
ROOT_DIR = Path(__file__).parents[1]
CLIENT_DIR = ROOT_DIR / 'emper-client'
EMPER_CLIENT_DIR = ROOT_DIR / 'emper-client'
CLIENTS_DIR = ROOT_DIR / 'clients'
TERMINATION_TIME = 10
"""Timeout used for awaiting termination of subprocesses"""
......
......@@ -201,7 +201,8 @@ def bench(server_cmds) -> EvalResult:
termination=TERMINATION,
remote_cmd=client_remote_cmd,
hosts=CLIENTS,
env=CLIENT_ENV)
env=CLIENT_ENV,
implementation=args.client_impl)
if bench_results[i] == BenchResult.FAIL:
log.warning('\nClient cmd failed. Terminate server')
......@@ -256,6 +257,10 @@ if __name__ == '__main__':
help='measure the IO done by all network interfaces',
default=False,
action='store_true')
parser.add_argument('--client-impl',
help='the client implementation to use',
choices=['emper', 'io_uring'],
default='emper')
parser.add_argument('--ssh-port',
help='ssh port to use for the connection to the host',
default=22,
......@@ -384,7 +389,9 @@ if __name__ == '__main__':
print(f"data_dir: {DATA_DIR}")
write_desc(DATA_DIR)
emper.prepare_client(DATA_DIR)
if args.client_impl == 'emper':
emper.prepare_client(DATA_DIR)
# generate selected emper flavors
if 'emper' in args.implementations:
......
Supports Markdown
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