Skip to content

Commit

Permalink
Add performance configuration (#2932)
Browse files Browse the repository at this point in the history
* Add new performance configuration - Ubuntu DS1
* Reduce performance test run loop from 100 to 10.
  • Loading branch information
troydai authored Apr 20, 2017
1 parent 2014b36 commit 09ed370
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 32 deletions.
64 changes: 36 additions & 28 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,38 @@
pipeline {
agent none
triggers { pollSCM('H/3 * * * *') }
stages {
stage ('Build') {
agent any
steps {
sh 'pip install -U virtualenv'
sh 'python -m virtualenv --clear env'
sh './scripts/jenkins_build.sh'
sh './scripts/jenkins_archive.sh'
}
post {
always { deleteDir() }
}
}
stage ('Performance-Test') {
agent { label 'perf-ubuntu-a0' }
when { expression { return env.BRANCH_NAME == 'master' || env.BRANCH_NAME.startsWith('performance') } }
steps {
sh 'pip install -U virtualenv'
sh 'python -m virtualenv --clear env'
sh './scripts/jenkins_perf.sh'
}
post {
always { deleteDir() }
}
}
node {
stage ('Build') {
node ('linux-build') {
checkout scm
sh './scripts/jenkins_build.sh'
sh './scripts/jenkins_archive.sh'
deleteDir()
}
}
stage ('Performance Test') {
def platforms = ['perf-ubuntu-a0', 'perf-ubuntu-ds1']
def perftests = [:]

for (int i = 0; i < platforms.size(); i++) {
platform = platforms.get(i)
perftests["Test ${platform}"] = perf_closure(platform)
}
perftests.failFast = false

parallel perftests
}
}

def perf_closure(platform) {
return {
node (platform) {
if (env.BRANCH_NAME != null && (env.BRANCH_NAME == 'master' || env.BRANCH_NAME.startsWith('performance'))) {
checkout scm
echo "Running performance test on ${platform}."
sh './scripts/jenkins_perf.sh'
deleteDir()
}
else {
echo "Skip performance test."
}
}
}
}
3 changes: 1 addition & 2 deletions scripts/jenkins_build.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# Build packages in Jenkins server.
# The script expects a virtualenv created under ./env folder as prerequisite

set -x # do not echo command to prevent accidentally expose secrets

python -m virtualenv --clear env
. ./env/bin/activate

echo 'Build Azure CLI and its command modules '
Expand Down
1 change: 1 addition & 0 deletions scripts/jenkins_perf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# Run performance in jenkins build

python -m virtualenv --clear env
. ./env/bin/activate

echo "Run performance test on $(hostname)"
Expand Down
3 changes: 1 addition & 2 deletions scripts/performance/measure.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@ def pstdev(data):
return (ss/n) ** 0.5


def scenario(command):
def scenario(command, loop=10):
real = []
user = []
syst = []
loop = 100

test_command = 'time -p ' + command
for i in range(loop):
Expand Down

0 comments on commit 09ed370

Please sign in to comment.