Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions python/analysisCDF/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
client/
2 changes: 2 additions & 0 deletions python/analysisCDF/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ARMONIK_ENDPOINT=http://localhost:3000
ARMONIK_PARTITION=cdf
17 changes: 17 additions & 0 deletions python/analysisCDF/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM python:3.10-slim AS builder
WORKDIR /app
RUN python -m venv .venv && .venv/bin/pip install --no-cache-dir -U pip setuptools
COPY worker/worker-requirements.txt ./
RUN .venv/bin/pip install --no-cache-dir -r worker-requirements.txt
COPY ./worker ./worker

FROM python:3.10-slim
WORKDIR /app
RUN groupadd --gid 5000 armonikuser \
&& useradd --home-dir /home/armonikuser --create-home --uid 5000 --gid 5000 --shell /bin/sh armonikuser \
&& mkdir /cache && chown armonikuser: /cache
USER armonikuser
ENV PATH="/app/.venv/bin:$PATH" \
PYTHONUNBUFFERED=1
COPY --from=builder /app /app
ENTRYPOINT ["python", "worker/worker.py"]
47 changes: 47 additions & 0 deletions python/analysisCDF/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# A Python Hello World on ArmoniK

## Description

This project contains a worker and a client to interact with ArmoniK's Control Plane. The worker processes a simple task sent by the Agent. The worker does nothing and sends a empty string to the Client.

## Preqrequisites
Create a partition named "cdf" with the worker's image in the terraform configuration file.

## Steps

1. Build the Docker image for the worker:
```bash
docker build -t cdf-worker -f Dockerfile .
```

2. Deploy ArmoniK locally by following the instructions at [ArmoniK Documentation](https://aneoconsulting.github.io/ArmoniK/). Ensure you create a new partition named "cdf" with the worker's image named "cdf-worker".

3. Move to the `client` folder and create a virtual environment:
```bash
cd client
python -m venv .venv
```

4. Activate the virtual environment:
```bash
source .venv/bin/activate
```

5. Install the client dependencies:
```bash
pip install -r client-requirements.txt
```

## Usage

Make sure the file "armonik_benchmark_cli.py" is executable:

```bash
chmod +x armonik_benchmark_cli.py
```

Run the Client with the name of the partition:

```bash
./armonik_benchmark_cli --partition cdf --endpoint localhost:5001
```
3 changes: 3 additions & 0 deletions python/analysisCDF/client/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.env
.venv/
__pycache__/
27 changes: 27 additions & 0 deletions python/analysisCDF/client/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Stage 1: Build the client with a virtual environment and install dependencies
FROM python:3.10-slim AS builder
WORKDIR /app
# Create a virtual environment and update pip and setuptools
RUN python -m venv .venv && .venv/bin/pip install --no-cache-dir -U pip setuptools
# Copy your requirements (adjust name if needed)
COPY requirements.txt ./
RUN .venv/bin/pip install --no-cache-dir -r requirements.txt
# Copy the whole source (including main.py)
COPY . .

# Stage 2: Create the runtime image
FROM python:3.10-slim
WORKDIR /app
# Create a non-root user to run the application
RUN groupadd --gid 5000 armonikuser && \
useradd --home-dir /home/armonikuser --create-home --uid 5000 --gid 5000 \
--shell /bin/sh --skel /dev/null armonikuser && \
mkdir -p /cache && chown armonikuser: /cache
USER armonikuser
# Set environment variables
ENV PATH="/app/.venv/bin:$PATH" \
PYTHONUNBUFFERED=1
# Copy the built app from the builder stage
COPY --from=builder /app /app
# Set the entrypoint to launch your benchmarking client
ENTRYPOINT ["python", "main.py"]
33 changes: 33 additions & 0 deletions python/analysisCDF/client/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"""
ArmoniK Benchmark Suite

A toolkit for benchmarking ArmoniK task processing capabilities
with zero-work tasks to measure scheduling overhead.
"""

__version__ = "1.0.0"

# Import key components for easy access
from .benchmark import run_batch, run_benchmarks

# Expose main entry point
from .main import main
from .reporting import print_summary, save_results_to_csv
from .visualization import (
generate_latency_percentile_graph,
generate_matplotlib_latency_graph,
generate_matplotlib_throughput_graph,
generate_throughput_graph,
)

__all__ = [
"run_batch",
"run_benchmarks",
"generate_latency_percentile_graph",
"generate_throughput_graph",
"generate_matplotlib_latency_graph",
"generate_matplotlib_throughput_graph",
"save_results_to_csv",
"print_summary",
"main",
]
18 changes: 18 additions & 0 deletions python/analysisCDF/client/armonik_benchmark_cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env python3
"""
ArmoniK Benchmark CLI

Command-line tool for benchmarking ArmoniK scheduling overhead.
"""

import os
import sys

# Insert the current directory (where main.py is located) into the PYTHONPATH
current_dir = os.path.abspath(os.path.dirname(__file__))
sys.path.insert(0, current_dir)

from main import main

if __name__ == "__main__":
sys.exit(main(sys.argv[1:]))
Loading
Loading