Skip to content

Commit e9bcdf8

Browse files
radikenclaude
andcommitted
Add multi_nimlibp2p_kad: kad-dht regression matrix (version x muxer)
Sequential kad-dht regression sweep across nim-libp2p versions and muxers, env-configurable via REGRESSION_* (smoke / single-version / full matrix). Each version x muxer combination is one full NimLibp2pExperiment run via Multiple. Rebased onto master from the stale alan/regression-campaign branch (20 commits behind). This runner was the only piece still unique to that branch -- the kad-dht mesh formation, publisher provisioning, and num_relay_nodes rename it was built on have since landed on master independently. Passes num_relay_nodes (not the old num_nodes key) and drops the add_parser override that master's BaseExperiment now forbids. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 9753357 commit e9bcdf8

1 file changed

Lines changed: 75 additions & 0 deletions

File tree

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
import os
2+
from typing import Iterable, List, Optional
3+
4+
from src.deployments.core.configs.container import Image
5+
from src.deployments.experiments.libp2p.nimlibp2p import NimLibp2pExperiment
6+
from src.deployments.experiments.multi_experiment import Multiple
7+
from src.deployments.registry import experiment
8+
9+
# nim-libp2p regression matrix: each version x muxer is one full kad-dht run.
10+
# The sweep is env-configurable so the same experiment drives a smoke test, a
11+
# single-version pass (runs are sequential to keep measurements clean), or the
12+
# full matrix -- see REGRESSION_* below.
13+
IMAGES = {
14+
"2.0.0": Image(repo="radiken/dst-test-node-regression", tag="v2.0.0-kad"),
15+
"2.1.0": Image(repo="radiken/dst-test-node-regression", tag="v2.1.0-kad"),
16+
}
17+
18+
19+
def _env_list(name: str, default: str) -> list:
20+
return [x.strip() for x in os.environ.get(name, default).split(",") if x.strip()]
21+
22+
23+
VERSIONS = _env_list("REGRESSION_VERSIONS", "2.1.0,2.0.0")
24+
MUXERS = _env_list("REGRESSION_MUXERS", "mplex,yamux,quic")
25+
MESSAGE_SIZES = [int(x) for x in _env_list("REGRESSION_SIZES", "1000")]
26+
NUM_NODES = int(os.environ.get("REGRESSION_NUM_NODES", "1000"))
27+
NUM_MESSAGES = int(os.environ.get("REGRESSION_NUM_MESSAGES", "600"))
28+
# delay_cold_start is how long we wait after the nodes are deployed (their start
29+
# delay + kad-dht mesh formation) before the publisher fires; shorten it via the
30+
# env var for small smoke runs.
31+
COLD_START = int(os.environ.get("REGRESSION_COLD_START", str(7 * 60)))
32+
33+
34+
@experiment(name="multi_nimlibp2p_kad")
35+
class MultiNimlibp2pKad(Multiple):
36+
"""nim-libp2p regression sweep: kad-dht, version x muxer."""
37+
38+
def model_post_init(self, __context) -> None:
39+
self.config.name = NimLibp2pExperiment.name
40+
super().model_post_init(__context)
41+
42+
def get_params_paths(self) -> Optional[dict]:
43+
return None
44+
45+
def exp_params(self) -> Iterable[dict]:
46+
base = {
47+
"discovery": "kad-dht",
48+
"bootstrap_nodes": 1,
49+
"num_relay_nodes": NUM_NODES,
50+
"num_messages": NUM_MESSAGES,
51+
"delay_after_publish": 1, # 1 msg/s
52+
"delay_cold_start": COLD_START,
53+
"node_start_delay": 5 * 60,
54+
}
55+
for version in VERSIONS:
56+
for size in MESSAGE_SIZES:
57+
for muxer in MUXERS:
58+
yield {
59+
**base,
60+
"image": IMAGES[version],
61+
"version": version,
62+
"muxer": muxer,
63+
"message_size_bytes": size,
64+
}
65+
66+
def get_params_list(self) -> List[dict]:
67+
return list(self.exp_params())
68+
69+
def get_name_from_params(self, params: dict) -> str:
70+
return (
71+
f"version_{params['version']}"
72+
f"__muxer_{params['muxer']}"
73+
f"__size_{params['message_size_bytes']}"
74+
f"__nodes_{params['num_relay_nodes']}"
75+
)

0 commit comments

Comments
 (0)