Files
canonical-stuff/ceph_bench/run.py
2023-09-06 16:40:52 +02:00

78 lines
1.8 KiB
Python

# copyright: Canonical
"Run the bench cases (remote to local)."
import json
import click
from benchmark import run_single_bench
from definitions import (
BENCH_DIR_NAMES,
CEPH_ROOT,
INST_STO_ROOT,
NUM_RUNS,
REMOTE_INST_STO_ROOT,
SERV_URL,
)
from results_tools import Results
results = Results()
@click.group()
def cli():
pass
@cli.command()
def local():
click.echo("Running locally")
for runnum in range(NUM_RUNS):
for files_type in BENCH_DIR_NAMES:
test_case = "Local-InsSto to local CEPH"
source = f"{INST_STO_ROOT}/{files_type}"
target = CEPH_ROOT + files_type
run_single_bench(
runnum,
test_case,
files_type,
source,
target,
results,
)
@cli.command()
def distant():
click.echo("Running distant to local")
for runnum in range(NUM_RUNS):
for files_type in BENCH_DIR_NAMES:
test_case = "Distant-InsSto to local InsSto"
source = f"{SERV_URL}/{REMOTE_INST_STO_ROOT}/{files_type}"
target = INST_STO_ROOT + files_type
run_single_bench(
runnum,
test_case,
files_type,
source,
target,
results,
)
test_case = "Distant-InsSto to local CEPH"
source = f"{SERV_URL}/{REMOTE_INST_STO_ROOT}/{files_type}"
target = CEPH_ROOT + files_type
run_single_bench(
runnum,
test_case,
files_type,
source,
target,
results,
)
if __name__ == "__main__":
cli()
json.dump(results.result_list, open("results.json", "w"))
results.save_to_csv()