Skip to content

Commit 8a3eb24

Browse files
feat: Add bench workflow
1 parent 8e69cdd commit 8a3eb24

File tree

8 files changed

+1437
-0
lines changed

8 files changed

+1437
-0
lines changed

.github/workflows/bench-benchmark.yml

+144
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
name: "Benchmark with Bench client"
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
release:
8+
types: [published, prereleased]
9+
workflow_dispatch:
10+
inputs:
11+
destroy-on-session-end:
12+
description: "Whether to destroy infrastructure right after the bench job has ended"
13+
type: boolean
14+
required: false
15+
default: true
16+
prefix:
17+
description: "Prefix for the infrastructure. The bucket associated with this prefix must be created before."
18+
required: false
19+
default: "ci-bench"
20+
21+
jobs:
22+
define-matrix:
23+
name: Define matrix
24+
runs-on: ubuntu-latest
25+
outputs:
26+
matrix: ${{ steps.types.outputs.matrix }}
27+
steps:
28+
- id: types
29+
name: Define matrix
30+
env:
31+
TRIGGER: ${{ github.event_name }}
32+
REF_NAME: ${{ github.ref_name }}
33+
run: |
34+
set -ex
35+
if [ "$TRIGGER" == 'push' ]; then
36+
echo '{"include":[{"type": "localhost", "ntasks":3000, "polling-limit": 300}]}' > matrix.json
37+
echo "FILE_PREFIX=$REF_NAME" >> $GITHUB_ENV
38+
elif [ "$TRIGGER" == 'release' ]; then
39+
echo '{"include":[{"type": "localhost", "ntasks":3000, "polling-limit": 300}, {"type": "aws", "ntasks":1200000, "polling-limit": 1000, "parameters-file-path": "benchmarking/aws/parameters.tfvars"}]}' > matrix.json
40+
echo "FILE_PREFIX=release/$REF_NAME" >> $GITHUB_ENV
41+
elif [ "$TRIGGER" == 'workflow_dispatch' ]; then
42+
echo '{"include":[{"type": "aws", "ntasks":1200000, "polling-limit": 1000, "parameters-file-path": "benchmarking/aws/parameters.tfvars"}]}' > matrix.json
43+
echo "FILE_PREFIX=manual/$REF_NAME" >> $GITHUB_ENV
44+
fi
45+
echo "matrix=$(cat matrix.json)" >> "$GITHUB_OUTPUT"
46+
47+
benchmark:
48+
name: ${{ matrix.type }}
49+
runs-on: ubuntu-latest
50+
needs: define-matrix
51+
strategy:
52+
fail-fast: false
53+
matrix: ${{ fromJson(needs.define-matrix.outputs.matrix) }}
54+
env:
55+
prefix: ${{ inputs.prefix || 'ci-bench' }}
56+
parameters-file-path: ${{ matrix.parameters-file-path }}
57+
outputs:
58+
terraform-output: ${{ steps.deploy.outputs.terraform-output }}
59+
armonik-endpoint: ${{ steps.get-armonik-endpoint.outputs.endpoint }}
60+
steps:
61+
- name: Checkout
62+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
63+
64+
- name: Install Dependencies
65+
uses: aneoconsulting/ArmoniK.Action.Deploy/dependencies@main
66+
with:
67+
terraform: true
68+
k3s: true
69+
docker: true
70+
aws: true
71+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
72+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
73+
AWS_REGION: eu-west-3
74+
75+
- name: Get Core version
76+
run: |
77+
set -ex
78+
echo "core-version=$(cat versions.tfvars.json | jq -r '.armonik_versions.core')" >> $GITHUB_ENV
79+
80+
- id: deploy
81+
name: "Deploy ArmoniK"
82+
uses: aneoconsulting/ArmoniK.Action.Deploy/deploy@main
83+
with:
84+
type: ${{ matrix.type }}
85+
prefix: ${{ env.prefix }}
86+
core-version: ${{ env.core-version }}
87+
parameters-file-path: ${{ env.parameters-file-path }}
88+
89+
- id: get-armonik-endpoint
90+
name: "Get ArmoniK's control plane endpoint"
91+
env:
92+
TYPE: ${{ matrix.type }}
93+
run: |
94+
set -ex
95+
grpc_endpoint=$(cat "infrastructure/quick-deploy/$TYPE/generated/armonik-output.json" | jq -r '.armonik.control_plane_url' | sed -r 's/(http:\/\/)([^:]*)(:.*)/\2/')
96+
echo "grpc-endpoint=$grpc_endpoint" >> "$GITHUB_OUTPUT"
97+
sleep 60
98+
99+
- id: bench
100+
name: Run Bench
101+
uses: aneoconsulting/ArmoniK.Action.Deploy/bench@main
102+
with:
103+
type: ${{ matrix.type }}
104+
armonik-core-version: ${{ env.core-version }}
105+
ntasks: ${{ matrix.ntasks }}
106+
session-name: bench
107+
grpc-client-endpoint: ${{ steps.get-armonik-endpoint.outputs.grpc-endpoint }}
108+
timeout: 1200
109+
110+
- id: get-bench-stats
111+
name: Get Bench Stats
112+
uses: aneoconsulting/ArmoniK.Action.Deploy/get-throughput@main
113+
with:
114+
grpc-client-endpoint: ${{ steps.get-armonik-endpoint.outputs.grpc-endpoint }}
115+
session-name: ${{ steps.bench.outputs.session-name }}
116+
poll-duration-limit: ${{ matrix.polling-limit }}
117+
118+
- name: Upload benchmark results to artifact registry
119+
uses: actions/upload-artifact@v4
120+
with:
121+
name: benchclient_benchmark_${{ github.event_name }}_${{ matrix.type }}_${{ github.run_id }}
122+
path: ${{ steps.get-bench-stats.outputs.bench-file-path }}
123+
124+
- name: Upload benchmark results to s3
125+
env:
126+
EVENT_NAME: ${{ github.event_name }}
127+
BENCH_RESULTS_PATH: ${{ steps.get-bench-stats.outputs.bench-file-path }}
128+
TYPE: ${{ matrix.type }}
129+
GHRUNID: ${{ github.run_id }}
130+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
131+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
132+
AWS_EC2_METADATA_DISABLED: true
133+
run: |
134+
DATE=$(date +"%Y-%m-%d")
135+
aws s3 cp "$BENCH_RESULTS_PATH" "s3://armonik-bench-storage/${FILE_PREFIX}/${GHRUNID}_${DATE}/benchclient_benchmark_${EVENT_NAME}_${TYPE}.json"
136+
137+
- if: ${{ (github.event_name == 'workflow_dispatch' && inputs.destroy-on-session-end) || (github.event_name != 'workflow_dispatch' && always()) }}
138+
id: destroy
139+
name: Destroy deployment
140+
uses: aneoconsulting/ArmoniK.Action.Deploy/destroy@main
141+
with:
142+
type: ${{ matrix.type }}
143+
prefix: ${{ env.prefix }}
144+
parameters-file-path: ${{ env.parameters-file-path }}

0 commit comments

Comments
 (0)