mirror of
https://github.com/codex-storage/bittorrent-benchmarks.git
synced 2025-02-24 08:48:16 +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 pathlib import Path
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
@ -5,6 +6,8 @@ from torrentool.torrent import Torrent
|
|||||||
|
|
||||||
from benchmarks.core.utils import random_data, megabytes
|
from benchmarks.core.utils import random_data, megabytes
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class DelugeAgent:
|
class DelugeAgent:
|
||||||
def __init__(self, torrents_path: Path, batch_size: int = megabytes(50)):
|
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 = self.torrents_path / name
|
||||||
torrent_path.mkdir(parents=True, exist_ok=False)
|
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"
|
file_path = torrent_path / "datafile.bin"
|
||||||
with file_path.open(mode="wb") as output:
|
with file_path.open(mode="wb") as output:
|
||||||
random_data(size=size, outfile=output, seed=seed)
|
random_data(size=size, outfile=output, seed=seed)
|
||||||
@ -22,4 +27,6 @@ class DelugeAgent:
|
|||||||
torrent = Torrent.create_from(torrent_path)
|
torrent = Torrent.create_from(torrent_path)
|
||||||
torrent.name = name
|
torrent.name = name
|
||||||
|
|
||||||
|
logger.info(f"Torrent {name} created successfully")
|
||||||
|
|
||||||
return torrent
|
return torrent
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import socket
|
import socket
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
from requests import ConnectionError
|
||||||
from tenacity import stop_after_attempt, wait_exponential, retry
|
from tenacity import stop_after_attempt, wait_exponential, retry
|
||||||
from torrentool.torrent import Torrent
|
from torrentool.torrent import Torrent
|
||||||
from urllib3.util import Url
|
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.
|
# Setting the correct name is critical, and it has to match what's in deluge the StatefulSet.
|
||||||
name: "${DELUGE_STATEFULSET}-{node_index}"
|
name: "${DELUGE_STATEFULSET}-{node_index}"
|
||||||
address: "${DELUGE_STATEFULSET}-{node_index}.${DELUGE_SERVICE}.${NAMESPACE}.svc.cluster.local"
|
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
|
daemon_port: 6890
|
||||||
listen_ports: [ 6891, 6892 ]
|
listen_ports: [ 6891, 6892 ]
|
||||||
|
|
||||||
|
@ -48,9 +48,7 @@ spec:
|
|||||||
valueFrom:
|
valueFrom:
|
||||||
fieldRef:
|
fieldRef:
|
||||||
fieldPath: metadata.namespace
|
fieldPath: metadata.namespace
|
||||||
volumeMounts:
|
|
||||||
- name: benchmark-volume
|
|
||||||
mountPath: /opt/bittorrent-benchmarks/volume
|
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
cpu: "1"
|
cpu: "1"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user