Commit 08d79646 authored by Florian Fischer's avatar Florian Fischer
Browse files

[eval.py] add doc strings

parent 06a67084
Pipeline #67392 failed with stage
in 3 minutes and 32 seconds
#!/usr/bin/env python3
"""Evaluation script for the EMPER echoserver evaluation artifact"""
import argparse
import datetime
......@@ -405,11 +406,13 @@ def prepare_env(update_env: MutableMapping) -> Dict:
def get_commit_id(repo=EMPER_REPO, commit_ish='HEAD') -> str:
"""Get git commit id of commitish from emper repo"""
cmd = f'git rev-parse {commit_ish}'
return subprocess.check_output(cmd.split(), cwd=repo, text=True)[:-1]
def emper_repo_add_muhq_remote():
"""Add muhq remote to emper repo"""
cmd = 'git remote add muhq https://gitlab.cs.fau.de/aj46ezos/emper.git'
subprocess.run(cmd.split(), cwd=EMPER_REPO, check=True)
......@@ -437,11 +440,13 @@ def cmd_run(cmd: str, cwd=None, env=None, check=True):
def checkout_emper_worktree(directory, checkout):
"""Create a new worktree of checkout at directory"""
worktree_cmd = f'git worktree add {directory} {checkout}'
cmd_run(worktree_cmd, cwd=EMPER_REPO)
def build_emper(emper_dir, meson_options='', build_env=None):
"""Build a emper variant at emper_dir"""
if not build_env:
build_env = {}
......@@ -459,6 +464,7 @@ def build_emper(emper_dir, meson_options='', build_env=None):
def prepare_client():
"""Prepare and build the special emper variant for the client"""
client_checkout = get_commit_id(EMPER_REPO, CLIENT_CHECKOUT)
with open(DATA_DIR / 'desc.yml', 'a') as desc_file:
......@@ -535,6 +541,7 @@ def update_emper_flavor(flavor_dir, checkout):
def prepare_emper_flavors(flavors):
"""Prepare a emper flavor defined in EMPER_FLAVORS to be evaluated"""
emper_server_cmd = SERVER_CMDS['emper']
del SERVER_CMDS['emper']
......@@ -644,7 +651,13 @@ def summarize(results: Mapping[str, Sequence[Sequence[BenchResult]]]):
print(summary, file=summary_file)
def bench() -> Dict[str, List[List[BenchResult]]]:
RunResult = List[BenchResult]
ServerResult = List[RunResult]
EvalResult = Dict[str, ServerResult]
def bench() -> EvalResult:
"""Run the benchmark for all selected servers and client arguments"""
results = {
server: [[BenchResult.SKIP] * len(ARGS) for r in range(RUNS)]
for server in SERVER_CMDS
......
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