From 3a319aa823e0e38652539fa4f75b2d033ee7f442 Mon Sep 17 00:00:00 2001 From: gmega Date: Sun, 1 Dec 2024 23:12:49 -0300 Subject: [PATCH] add Dockerfile and run script --- benchmarks/cli.py | 6 +++++- docker/bittorrent-benchmarks.Dockerfile | 15 +++++++++++++++ pyproject.toml | 6 ++++-- 3 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 docker/bittorrent-benchmarks.Dockerfile diff --git a/benchmarks/cli.py b/benchmarks/cli.py index 409574b..f3a9949 100644 --- a/benchmarks/cli.py +++ b/benchmarks/cli.py @@ -60,6 +60,10 @@ def _init_logging(): ) -if __name__ == '__main__': +def main(): _init_logging() app() + + +if __name__ == '__main__': + main() diff --git a/docker/bittorrent-benchmarks.Dockerfile b/docker/bittorrent-benchmarks.Dockerfile new file mode 100644 index 0000000..88e92cb --- /dev/null +++ b/docker/bittorrent-benchmarks.Dockerfile @@ -0,0 +1,15 @@ +FROM python:3.12-slim + +RUN pip install poetry && poetry config virtualenvs.create false + +RUN mkdir /opt/bittorrent-benchmarks +WORKDIR /opt/bittorrent-benchmarks + +COPY pyproject.toml poetry.lock ./ +RUN poetry install --no-root + +COPY . . +RUN poetry install + +ENTRYPOINT ["/usr/local/bin/bittorrent-benchmarks", "run", "/opt/bittorrent-benchmarks/experiments.yaml"] + diff --git a/pyproject.toml b/pyproject.toml index aa25a89..6b00b47 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,11 +1,10 @@ [tool.poetry] -name = "bittorrent-benchmarks" +name = "benchmarks" version = "0.1.0" description = "Harness for benchmarking Codex against BitTorrent." authors = ["Your Name "] license = "MIT" readme = "README.md" -package-mode = false [tool.poetry.dependencies] python = "^3.12" @@ -32,3 +31,6 @@ ignore_missing_imports = true [build-system] requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" + +[tool.poetry.scripts] +bittorrent-benchmarks = "benchmarks.cli:main" \ No newline at end of file