Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Bench session workflow on localhost #1328

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 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
104 changes: 104 additions & 0 deletions .github/workflows/bench-localhost.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: "Bench HTC Mock on localhost"

on:
push:
branches:
- "ts/add-bench-workflow"
- "main"
workflow_dispatch:
inputs:
ntasks:
description: "Number of tasks to be created"
default: "100"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the default should be more like 100k or 1M

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eventhough it is on localhost ?

required: false
subtasks-levels:
description: "Levels of subtasking"
default: "1"
required: false
Comment on lines +14 to +17
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not used for bench

purge-data:
description: "Whether to purge session"
default: "false"
required: false
release:
types: [created, published]

jobs:
bench:
name: Get Bench session stats
runs-on: ubuntu-latest
outputs:
terraform-output: ${{ steps.deploy.outputs.terraform-output }}
armonik-endpoint: ${{ steps.get-armonik-endpoint.outputs.endpoint }}
steps:

- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4

- name: Install Dependencies
uses: aneoconsulting/ArmoniK.Action.Deploy/dependencies@main
with:
terraform: true
k3s: true
docker: true

- name: Define runner env variables
run: |
echo "core-version=$(cat versions.tfvars.json | jq '.armonik_versions.core' | sed -r 's/"//g')" >> $GITHUB_ENV
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
echo "core-version=$(cat versions.tfvars.json | jq '.armonik_versions.core' | sed -r 's/"//g')" >> $GITHUB_ENV
echo "core-version=$(cat versions.tfvars.json | jq -r '.armonik_versions.core')" >> $GITHUB_ENV

echo "ntasks=${{ inputs.ntasks || 500 }}" >> $GITHUB_ENV
echo "purge-data=${{ inputs.purge-data || false }}" >> $GITHUB_ENV
Comment on lines +47 to +48
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure || works, but even if it does, you should take the default value defined in the parameter itself.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Workflows do not consider inputs if they're triggered by an event other than workflow_dispatch or worfklow_call


- id: deploy
name: "Deploy ArmoniK"
uses: aneoconsulting/ArmoniK.Action.Deploy/deploy@main
with:
type: localhost

- id: get-armonik-endpoint
name: "Get ArmoniK's control plane endpoint"
run: |
endpoint=$(cat infrastructure/quick-deploy/localhost/generated/armonik-output.json | jq '.armonik.control_plane_url' | sed -r 's/("http:\/\/)([^:]*)(:.*)/\2/')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
endpoint=$(cat infrastructure/quick-deploy/localhost/generated/armonik-output.json | jq '.armonik.control_plane_url' | sed -r 's/("http:\/\/)([^:]*)(:.*)/\2/')
endpoint=$(cat infrastructure/quick-deploy/localhost/generated/armonik-output.json | jq -r '.armonik.control_plane_url' | sed -r 's/(http:\/\/)([^:]*)(:.*)/\2/')

echo "endpoint=$endpoint" >> "$GITHUB_OUTPUT"

- id: bench
name: Run Bench session
uses: aneoconsulting/ArmoniK.Action.Deploy/bench@ts/add-bench-action
with:
armonik-core-version: ${{ env.core-version }}
ntasks: ${{ env.ntasks}}
session-name: bench1
grpc-client-endpoint: ${{ steps.get-armonik-endpoint.outputs.endpoint }}
purge-data: ${{ env.purge-data }}

- id: get-throughput
name: Get Session Throughput
uses: aneoconsulting/ArmoniK.Action.Deploy/get-throughput@main
with:
grpc-client-endpoint: ${{ steps.get-armonik-endpoint.outputs.endpoint }}
session-name: ${{ steps.bench.outputs.session-name }}

- name: Upload bench results to artifact registry
uses: actions/upload-artifact@v4
with:
name: bench-results
path: ${{ steps.get-throughput.outputs.bench-file-path }}

- name: Get current date
run: |
echo "date=$(printf '%(%Y-%m-%d-%Hh%Mm%Ss)T')" >> $GITHUB_ENV
Comment on lines +85 to +87
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you really want to have this, it should be at the start of the action


- name: (test) Upload bench results to s3
env:
BENCH_RESULTS_PATH: ${{ steps.get-throughput.outputs.bench-file-path }}
COMMIT_SHA: ${{ github.sha }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_EC2_METADATA_DISABLED: true
run: |
aws s3 cp "$BENCH_RESULTS_PATH" "s3://test-armonik-bench-storage/commit/$COMMIT_SHA/$date-bench-$ntasks_tasks.json"

- if: "always()"
id: destroy
name: Destroy deployment
uses: aneoconsulting/ArmoniK.Action.Deploy/destroy@main
with:
type: localhost
106 changes: 106 additions & 0 deletions .github/workflows/htcmock-localhost.yml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to have a single action with a matrix that does all the benchmarks

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree!

Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: "Bench HTC Mock on localhost"

on:
push:
branches:
- "ts/add-htc-mock-worflow"
- "ts/ci-**"
workflow_dispatch:
inputs:
ntasks:
description: "Number of tasks to be created"
default: "100"
required: false
subtasks-levels:
description: "Levels of subtasking"
default: "1"
required: false
purge-data:
description: "Whether to purge session"
default: "false"
required: false
release:
types: [created, published]

jobs:
htc-mock:
name: Get HTC Mock throughput
runs-on: ubuntu-latest
outputs:
terraform-output: ${{ steps.deploy.outputs.terraform-output }}
armonik-endpoint: ${{ steps.get-armonik-endpoint.outputs.endpoint }}
steps:

- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4

- name: Install Dependencies
uses: aneoconsulting/ArmoniK.Action.Deploy/dependencies@main
with:
terraform: true
k3s: true
docker: true

- name: Define runner env variables
run: |
echo "core-version=$(cat versions.tfvars.json | jq '.armonik_versions.core' | sed -r 's/"//g')" >> $GITHUB_ENV
echo "ntasks=${{ inputs.ntasks || 500 }}" >> $GITHUB_ENV
echo "subtasks-levels=${{ inputs.subtasks-levels || 5 }}" >> $GITHUB_ENV
echo "purge-data=${{ inputs.purge-data || false }}" >> $GITHUB_ENV

- id: deploy
name: "Deploy ArmoniK"
uses: aneoconsulting/ArmoniK.Action.Deploy/deploy@main
with:
type: localhost

- id: get-armonik-endpoint
name: "Get ArmoniK's control plane endpoint"
run: |
endpoint=$(cat infrastructure/quick-deploy/localhost/generated/armonik-output.json | jq '.armonik.control_plane_url' | sed -r 's/("http:\/\/)([^:]*)(:.*)/\2/')
echo "endpoint=$endpoint" >> "$GITHUB_OUTPUT"

- name: Get current date
run: |
echo "date=$(printf '%(%Y-%m-%d-%Hh%Mm%Ss)T')" >> $GITHUB_ENV

- id: htcmock
name: Run HTC Mock
uses: aneoconsulting/ArmoniK.Action.Deploy/htcmock@main
with:
armonik-core-version: ${{ env.core-version }}
ntasks: ${{ env.ntasks}}
subtasks-levels: ${{ env.subtasks-levels }}
session-name: htcmock1
grpc-client-endpoint: ${{ steps.get-armonik-endpoint.outputs.endpoint }}
purge-data: ${{ env.purge-data }}

- id: get-throughput
name: Get Session Throughput
uses: aneoconsulting/ArmoniK.Action.Deploy/get-throughput@main
with:
grpc-client-endpoint: ${{ steps.get-armonik-endpoint.outputs.endpoint }}
session-name: ${{ steps.htcmock.outputs.session-name }}

- name: Upload bench results to artifact registry
uses: actions/upload-artifact@v4
with:
name: htc-mock-results
path: ${{ steps.get-throughput.outputs.bench-file-path }}

- name: (test) Upload bench results to s3
env:
BENCH_RESULTS_PATH: ${{ steps.get-throughput.outputs.bench-file-path }}
COMMIT_SHA: ${{ github.sha }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_EC2_METADATA_DISABLED: true
run: |
aws s3 cp "$BENCH_RESULTS_PATH" "s3://test-armonik-bench-storage/commit/$COMMIT_SHA/$date-htcmock-$ntasks_tasks.json"

- if: "always()"
id: destroy
name: Destroy deployment
uses: aneoconsulting/ArmoniK.Action.Deploy/destroy@main
with:
type: localhost
27 changes: 27 additions & 0 deletions tools/ci/bench-job-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: batch/v1
kind: Job
metadata:
name: bench-session
namespace: armonik
spec:
ttlSecondsAfterFinished: 0
template:
spec:
containers:

Check warning

Code scanning / SonarCloud

Service account permissions should be restricted Medium

Bind this resource's automounted service account to RBAC or disable automounting. See more on SonarCloud
- name: bench-session

Check warning

Code scanning / SonarCloud

Storage limits should be enforced Medium

Specify a storage limit for this container. See more on SonarCloud

Check warning

Code scanning / SonarCloud

Memory limits should be enforced Medium

Specify a memory limit for this container. See more on SonarCloud
image: dockerhubaneo/armonik_core_bench_test_client::@@ARMONIK_CORE_VERSION@@
env:
- name: BenchOptions__NTasks
value: "@@NTASKS@@"
- name: BenchOptions__Partition
value: bench
- name: BenchOptions__Options__SessionName
value: "@@SESSION_NAME@@"
- name: BenchOptions__PurgeData
value: "@@PURGE_DATA@@"
- name: BenchOptions__DownloadResults
value: "false"
- name: GrpcClient__Endpoint
value: http://@@GRPC_CLIENT_ENDPOINT@@:5001

restartPolicy: Never
35 changes: 35 additions & 0 deletions tools/ci/htcmock-job-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
apiVersion: batch/v1
kind: Job
metadata:
name: htcmock-session
namespace: armonik
spec:
ttlSecondsAfterFinished: 0
template:
spec:
containers:

Check warning

Code scanning / SonarCloud

Service account permissions should be restricted Medium

Bind this resource's automounted service account to RBAC or disable automounting. See more on SonarCloud
- name: htcmock-session

Check warning

Code scanning / SonarCloud

Memory limits should be enforced Medium

Specify a memory limit for this container. See more on SonarCloud

Check warning

Code scanning / SonarCloud

Storage limits should be enforced Medium

Specify a storage limit for this container. See more on SonarCloud
image: dockerhubaneo/armonik_core_htcmock_test_client:@@ARMONIK_CORE_VERSION@@
env:
- name: HtcMock__NTasks
value: "@@NTASKS@@"
- name: HtcMock__TotalCalculationTime
value: "00:00:00.100"
- name: HtcMock__DataSize
value: "1"
- name: HtcMock__MemorySize
value: "1"
- name: HtcMock__EnableFastCompute
value: "true"
- name: HtcMock__SubTasksLevels
value: "@@SUBTASKS_LEVELS@@"
- name: HtcMock__Partition
value: htcmock
- name: HtcMock__Options__SessionName
value: "@@SESSION_NAME@@"
- name: HtcMock__PurgeData
value: "@@PURGE_DATA@@"
- name: GrpcClient__Endpoint
value: http://@@GRPC_CLIENT_ENDPOINT@@:5001

restartPolicy: Never
Loading
Loading