Skip to content
This repository has been archived by the owner on May 31, 2024. It is now read-only.

Commit

Permalink
test: Added context deploy benchmarking script (#111)
Browse files Browse the repository at this point in the history
* Context deploy benchmark script
  • Loading branch information
abassyiouni authored Nov 2, 2021
1 parent 387393a commit 1b24bd0
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 0 deletions.
51 changes: 51 additions & 0 deletions scripts/context-deploy-benchmark/context-benchmark.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/env bash

CONTEXT_AMOUNT=5
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"

deploy_contexts_sequential() {
for ((i = 1; i <= CONTEXT_AMOUNT; i++))
do
agc context deploy -c "$1$i";
done
}

cleanup_contexts() {
for ((i = 1; i <= CONTEXT_AMOUNT; i++))
do
agc context destroy -c "$1$i";
done
}

deploy_contexts_all() {
agc context deploy --all;
}

get_average_runtime() {
START_SECONDS=$(date +%s)
$1 $2
END_SECONDS=$(date +%s)
DIFF_SECONDS=$((END_SECONDS-START_SECONDS))
AVERAGE_SECONDS=$(((DIFF_SECONDS%60)/CONTEXT_AMOUNT))
AVERAGE_MINUTES=$(((DIFF_SECONDS/60)/CONTEXT_AMOUNT))
echo "Average $2 $3 time across $CONTEXT_AMOUNT contexts is: $AVERAGE_MINUTES m $AVERAGE_SECONDS s"
}

get_all_averages() {
get_average_runtime deploy_contexts_sequential "$1" "sequential deployment"
cleanup_contexts "$1"
get_average_runtime deploy_contexts_all "$1" "all deployment"
get_average_runtime cleanup_contexts "$1" "destruction"
}

validate_and_run() {
if [ $1 != "1" ] || [[ $2 != "cromwell" && $2 != "nextflow" ]]
then
echo "Please specify engine type to benchmark (cromwell | nextflow)"
else
cd "$SCRIPT_DIR/$2"
get_all_averages $2
fi
}

validate_and_run $# $1
24 changes: 24 additions & 0 deletions scripts/context-deploy-benchmark/cromwell/agc-project.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: CromwellContextBenchmarkTest
schemaVersion: 1
contexts:
cromwell1:
engines:
- type: wdl
engine: cromwell
cromwell2:
engines:
- type: wdl
engine: cromwell
cromwell3:
engines:
- type: wdl
engine: cromwell
cromwell4:
engines:
- type: wdl
engine: cromwell
cromwell5:
engines:
- type: wdl
engine: cromwell
24 changes: 24 additions & 0 deletions scripts/context-deploy-benchmark/nextflow/agc-project.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: NextflowContextBenchmarkTest
schemaVersion: 1
contexts:
nextflow1:
engines:
- type: nextflow
engine: nextflow
nextflow2:
engines:
- type: nextflow
engine: nextflow
nextflow3:
engines:
- type: nextflow
engine: nextflow
nextflow4:
engines:
- type: nextflow
engine: nextflow
nextflow5:
engines:
- type: nextflow
engine: nextflow

0 comments on commit 1b24bd0

Please sign in to comment.