mirror of
https://github.com/codex-storage/bittorrent-benchmarks.git
synced 2025-02-24 00:38:13 +00:00
feat: runnable experiment with working test runner and agents
This commit is contained in:
parent
6978b7ef28
commit
ab100c4841
@ -1,3 +1,4 @@
|
||||
import logging
|
||||
from pathlib import Path
|
||||
from typing import Optional
|
||||
|
||||
@ -5,6 +6,8 @@ from torrentool.torrent import Torrent
|
||||
|
||||
from benchmarks.core.utils import random_data, megabytes
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class DelugeAgent:
|
||||
def __init__(self, torrents_path: Path, batch_size: int = megabytes(50)):
|
||||
@ -15,6 +18,8 @@ class DelugeAgent:
|
||||
torrent_path = self.torrents_path / name
|
||||
torrent_path.mkdir(parents=True, exist_ok=False)
|
||||
|
||||
logger.info(f"Creating torrent {name} with size {size} and seed {seed}")
|
||||
|
||||
file_path = torrent_path / "datafile.bin"
|
||||
with file_path.open(mode="wb") as output:
|
||||
random_data(size=size, outfile=output, seed=seed)
|
||||
@ -22,4 +27,6 @@ class DelugeAgent:
|
||||
torrent = Torrent.create_from(torrent_path)
|
||||
torrent.name = name
|
||||
|
||||
logger.info(f"Torrent {name} created successfully")
|
||||
|
||||
return torrent
|
||||
|
@ -1,6 +1,7 @@
|
||||
import socket
|
||||
|
||||
import requests
|
||||
from requests import ConnectionError
|
||||
from tenacity import stop_after_attempt, wait_exponential, retry
|
||||
from torrentool.torrent import Torrent
|
||||
from urllib3.util import Url
|
||||
|
@ -13,7 +13,7 @@ deluge_experiment:
|
||||
# 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"
|
||||
agent_url: "http://${DELUGE_STATEFULSET}-{node_index}.${DELUGE_SERVICE}.${NAMESPACE}:${DELUGE_AGENT_PORT}/"
|
||||
agent_url: "http://${DELUGE_STATEFULSET}-{node_index}.${DELUGE_SERVICE}.${NAMESPACE}:9001/"
|
||||
daemon_port: 6890
|
||||
listen_ports: [ 6891, 6892 ]
|
||||
|
||||
|
@ -48,9 +48,7 @@ spec:
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.namespace
|
||||
volumeMounts:
|
||||
- name: benchmark-volume
|
||||
mountPath: /opt/bittorrent-benchmarks/volume
|
||||
|
||||
resources:
|
||||
requests:
|
||||
cpu: "1"
|
||||
|
Loading…
x
Reference in New Issue
Block a user