From a0909a2b8099d0c2615c5c80a8be33045554052d Mon Sep 17 00:00:00 2001 From: Christian Schwarz Date: Fri, 24 Nov 2023 14:58:21 +0000 Subject: [PATCH] make the benchmarking script work again --- test_runner/fixtures/neon_fixtures.py | 18 ++++++++++-------- test_runner/performance/test_pageserver.py | 20 +++++++++++++------- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/test_runner/fixtures/neon_fixtures.py b/test_runner/fixtures/neon_fixtures.py index 761a45db4e..cb0b065f92 100644 --- a/test_runner/fixtures/neon_fixtures.py +++ b/test_runner/fixtures/neon_fixtures.py @@ -724,8 +724,8 @@ class NeonEnv: self.initial_tenant = config.initial_tenant self.initial_timeline = config.initial_timeline - self.control_plane_api = None - self.attachment_service = None + self.control_plane_api: Optional[str] = None + self.attachment_service: Optional[NeonAttachmentService] = None if config.enable_generations: self.enable_generations() @@ -820,11 +820,11 @@ class NeonEnv: if not start: # TODO: assert that we haven't `self.start()`ed yet pass - assert self.control_plane_api == None - assert self.attachment_service == None + assert self.control_plane_api is None + assert self.attachment_service is None attachment_service_port = self.port_distributor.get_port() - self.control_plane_api: Optional[str] = f"http://127.0.0.1:{attachment_service_port}" - self.attachment_service: Optional[NeonAttachmentService] = NeonAttachmentService(self) + self.control_plane_api = f"http://127.0.0.1:{attachment_service_port}" + self.attachment_service = NeonAttachmentService(self) if start: self.attachment_service.start() @@ -1566,16 +1566,18 @@ class ComputeCtl(AbstractNeonCli): COMMAND = "compute_ctl" + # class GetpageBenchLibpq(AbstractNeonCli): # """ # A typed wrapper around the `getpage_bench_libpq` CLI. # """ -# +# # COMMAND = "getpage_bench_libpq" -# +# # def run(self): # pass + class NeonAttachmentService: def __init__(self, env: NeonEnv): self.env = env diff --git a/test_runner/performance/test_pageserver.py b/test_runner/performance/test_pageserver.py index ab655efb84..3289f829cd 100644 --- a/test_runner/performance/test_pageserver.py +++ b/test_runner/performance/test_pageserver.py @@ -1,14 +1,15 @@ import json -from pathlib import Path import shutil import subprocess -from fixtures.compare_fixtures import NeonCompare -from fixtures.remote_storage import LocalFsStorage, RemoteStorageKind +from pathlib import Path +from typing import List + +from fixtures.benchmark_fixture import NeonBenchmarker +from fixtures.log_helper import log from fixtures.neon_fixtures import NeonEnvBuilder, PgBin, last_flush_lsn_upload from fixtures.pageserver.utils import wait_until_tenant_active +from fixtures.remote_storage import LocalFsStorage, RemoteStorageKind from fixtures.types import TenantId -from fixtures.log_helper import log -from fixtures.benchmark_fixture import NeonBenchmarker def test_getpage_throughput( @@ -69,8 +70,10 @@ def test_getpage_throughput( for file in tl.iterdir(): shutil.copy2(file, dst_tl_dir) if "__" in file.name: - cmd = [ - env.neon_binpath / "pagectl", # TODO: abstract this like the other binaries + cmd: List[str] = [ + str( + env.neon_binpath / "pagectl" + ), # TODO: abstract this like the other binaries "layer", "rewrite-summary", str(dst_tl_dir / file.name), @@ -110,9 +113,12 @@ def test_getpage_throughput( "10000", *[str(tenant) for tenant in tenants], ] + log.info(f"command: {' '.join(cmd)}") basepath = pg_bin.run_capture(cmd) results_path = Path(basepath + ".stdout") log.info(f"Benchmark results at: {results_path}") with open(results_path, "r") as f: results = json.load(f) + + log.info(f"Results:\n{json.dumps(results, sort_keys=True, indent=2)}")