add explicit naming for deluge nodes

This commit is contained in:
gmega 2024-12-06 15:24:11 -03:00
parent 890d57a589
commit 4e2e091c75
No known key found for this signature in database
GPG Key ID: 6290D34EAD824B18
5 changed files with 22 additions and 5 deletions

View File

@ -16,6 +16,7 @@ from benchmarks.deluge.tracker import Tracker
class DelugeNodeConfig(BaseModel):
name: str
address: Host
daemon_port: int
listen_ports: list[int] = Field(min_length=2, max_length=2)
@ -23,6 +24,7 @@ class DelugeNodeConfig(BaseModel):
class DelugeNodeSetConfig(BaseModel):
network_size: int = Field(gt=1)
name: str
address: str
daemon_port: int
listen_ports: list[int] = Field(min_length=2, max_length=2)
@ -33,6 +35,7 @@ class DelugeNodeSetConfig(BaseModel):
def expand_nodes(self):
self.nodes = [
DelugeNodeConfig(
name=self.name.format(node_index=str(i)),
address=self.address.format(node_index=str(i)),
daemon_port=self.daemon_port,
listen_ports=self.listen_ports,
@ -58,7 +61,7 @@ class DelugeExperimentConfig(ExperimentBuilder[DelugeDisseminationExperiment]):
network = [
DelugeNode(
name=f'deluge-{i + 1}',
name=node_spec.name,
volume=self.shared_volume_path,
daemon_port=node_spec.daemon_port,
daemon_address=str(node_spec.address),

View File

@ -10,6 +10,7 @@ from benchmarks.deluge.deluge_node import DelugeNode
def test_should_expand_node_sets_into_simple_nodes():
nodeset = DelugeNodeSetConfig(
name='custom-{node_index}',
address='deluge-{node_index}.local.svc',
network_size=4,
daemon_port=6080,
@ -18,21 +19,25 @@ def test_should_expand_node_sets_into_simple_nodes():
assert nodeset.nodes == [
DelugeNodeConfig(
name='custom-1',
address='deluge-1.local.svc',
daemon_port=6080,
listen_ports=[6081, 6082],
),
DelugeNodeConfig(
name='custom-2',
address='deluge-2.local.svc',
daemon_port=6080,
listen_ports=[6081, 6082],
),
DelugeNodeConfig(
name='custom-3',
address='deluge-3.local.svc',
daemon_port=6080,
listen_ports=[6081, 6082],
),
DelugeNodeConfig(
name='custom-4',
address='deluge-4.local.svc',
daemon_port=6080,
listen_ports=[6081, 6082],
@ -41,6 +46,7 @@ def test_should_expand_node_sets_into_simple_nodes():
def test_should_respect_first_node_index():
nodeset = DelugeNodeSetConfig(
name='deluge-{node_index}',
address='deluge-{node_index}.local.svc',
network_size=2,
daemon_port=6080,
@ -50,11 +56,13 @@ def test_should_respect_first_node_index():
assert nodeset.nodes == [
DelugeNodeConfig(
name='deluge-5',
address='deluge-5.local.svc',
daemon_port=6080,
listen_ports=[6081, 6082],
),
DelugeNodeConfig(
name='deluge-6',
address='deluge-6.local.svc',
daemon_port=6080,
listen_ports=[6081, 6082],
@ -72,6 +80,7 @@ def test_should_build_experiment_from_config():
nodes:
network_size: 10
name: 'deluge-{node_index}'
address: 'node-{node_index}.deluge.codexbenchmarks.svc.cluster.local'
daemon_port: 6890
listen_ports: [ 6891, 6892 ]

View File

@ -19,4 +19,4 @@ RUN if [ "$BUILD_TYPE" = "release" ]; then \
COPY . .
RUN poetry install --only main
ENTRYPOINT ["poetry", "run", "bittorrent-benchmarks", "/opt/bittorrent-benchmarks/experiments.yaml"]
ENTRYPOINT ["poetry", "run", "bittorrent-benchmarks", "/opt/bittorrent-benchmarks/experiments.k8s.yaml"]

View File

@ -8,6 +8,8 @@ deluge_experiment:
nodes:
network_size: ${NETWORK_SIZE}
first_node_index: 0
# Setting the correct name is critical, and it has to match what's in deluge the StatefulSet.
name: "${DELUGE_STATEFULSET}-{node_index}"
address: "${DELUGE_STATEFULSET}-{node_index}.${DELUGE_SERVICE}.${NAMESPACE}.svc.cluster.local"
daemon_port: 6890
listen_ports: [ 6891, 6892 ]

View File

@ -8,12 +8,15 @@ deluge_experiment:
shared_volume_path: ${PWD}/volume
nodes:
- address: ${DELUGE_NODE_1:-localhost}
- name: deluge-1
address: ${DELUGE_NODE_1:-localhost}
daemon_port: 6890
listen_ports: [ 6891, 6892 ]
- address: ${DELUGE_NODE_2:-localhost}
- name: deluge-2
address: ${DELUGE_NODE_2:-localhost}
daemon_port: 6893
listen_ports: [ 6894, 6895 ]
- address: ${DELUGE_NODE_3:-localhost}
- name: deluge-2
address: ${DELUGE_NODE_3:-localhost}
daemon_port: 6896
listen_ports: [ 6897, 6898 ]