Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions test/perf-test/cleanup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

for i in `kubectl get appwrapper -n default |grep defaultaw | awk '{print $1}'`; do kubectl delete appwrapper $i -n default ; done
71 changes: 71 additions & 0 deletions test/perf-test/perf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/bin/bash

read -p "How many appwrapper jobs do you want?" jobs

# Start the timer now
SECONDS=0

echo "jobs number is $jobs"
export STARTTIME=`date +"%T"`
echo " "
echo "Jobs started at: $STARTTIME" |tee job-$STARTTIME.log
echo " "

# This fixes the number of jobs to be one less so the for loop gets the right amount
((realjobs=$jobs-1))

for num in $(eval echo "{0.."$realjobs"}")
do
next_num=$(($num + 1))
echo "Submitting job $next_num"
# Had to do this OSTYPE because sed acts differently on Linux versus Mac
case "$OSTYPE" in
linux-gnu*)
sed -i "s/defaultaw-schd-spec-with-timeout-$num/defaultaw-schd-spec-with-timeout-$next_num/g" preempt-exp.yaml ;;
darwin*)
sed -i '' "s/defaultaw-schd-spec-with-timeout-$num/defaultaw-schd-spec-with-timeout-$next_num/g" preempt-exp.yaml ;;
*)
sed -i "s/defaultaw-schd-spec-with-timeout-$num/defaultaw-schd-spec-with-timeout-$next_num/g" preempt-exp.yaml ;;
esac
oc apply -f preempt-exp.yaml
done

# Let's reset the original preempt-exp.yaml file back to original value
case "$OSTYPE" in
linux-gnu*)
sed -i "s/defaultaw-schd-spec-with-timeout-$next_num/defaultaw-schd-spec-with-timeout-1/g" preempt-exp.yaml ;;
darwin*)
sed -i '' "s/defaultaw-schd-spec-with-timeout-$next_num/defaultaw-schd-spec-with-timeout-1/g" preempt-exp.yaml ;;
*)
sed -i "s/defaultaw-schd-spec-with-timeout-$next_num/defaultaw-schd-spec-with-timeout-1/g" preempt-exp.yaml ;;
esac

# Check for all jobs to report complete
jobstatus=`oc get jobs --no-headers --field-selector status.successful=1 |wc -l`

while [ $jobstatus -lt $jobs ]
do
echo "Number of completed jobs is: " $jobstatus " and the goal is: " $jobs
sleep 10
jobstatus=`oc get jobs --no-headers --field-selector status.successful=1 |wc -l`
done

echo " "
export FINISHTIME=`date +"%T"`
echo "All $jobstatus jobs finished: $FINISHTIME" |tee -a job-$STARTTIME.log
echo "Total amount of time for $jobs appwrappers is: $SECONDS seconds" |tee -a job-$STARTTIME.log
echo " "
echo "Test results are stored in this file: job-$next_num-$STARTTIME.log"

# Rename the log to show the number of jobs used
mv job-$STARTTIME.log job-$next_num-$STARTTIME.log

#Ask if you want to auto-cleanup the appwrapper jobs
echo "Do you want to cleanup the most recently created appwrappers? [Y/n]"
read DELETE
if [[ $DELETE == "Y" || $DELETE == "y" ]]; then
echo "OK, deleting"
./cleanup.sh
else
echo "OK, you'll need to cleanup yourself later using ./cleanup.sh"
fi
57 changes: 57 additions & 0 deletions test/perf-test/preempt-exp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
apiVersion: mcad.ibm.com/v1beta1
kind: AppWrapper
metadata:
name: defaultaw-schd-spec-with-timeout-1
namespace: default
spec:
schedulingSpec:
minAvailable: 1
requeuing:
timeInSeconds: 120
growthType: "exponential"
priority: 9
resources:
Items: []
GenericItems:
- replicas: 1
completionstatus: Complete
custompodresources:
- replicas: 1
requests:
cpu: 500m
memory: 512M
nvidia.com/gpu: 0
limits:
cpu: 500m
memory: 512M
nvidia.com/gpu: 0
generictemplate:
apiVersion: batch/v1
kind: Job
metadata:
namespace: default
name: defaultaw-schd-spec-with-timeout-1
# labels:
# appwrapper.mcad.ibm.com: defaultaw-schd-spec-with-timeout-1
spec:
parallelism: 1
completions: 1
template:
metadata:
namespace: default
labels:
appwrapper.mcad.ibm.com: "defaultaw-schd-spec-with-timeout-1"
spec:
containers:
- name: defaultaw-schd-spec-with-timeout-1
image: ubuntu:latest
command: [ "/bin/bash", "-c", "--" ]
args: [ "sleep 10" ]
resources:
requests:
memory: "512Mi"
cpu: "500m"
limits:
memory: "512Mi"
cpu: "500m"
restartPolicy: Never