Changeset - 8a60eb2b7603
[Not reviewed]
default
0 1 0
domruf - 9 years ago 2017-04-09 00:13:17
dominikruf@gmail.com
Jenkinsfile: run each py.test on a separate executor

Running all py.test processes in parallel on the same executor is not a good idea.
If a node has not much RAM, it could run out of memory when all py.test processes
run at the same time. And If there are only 2 CPU cores, it doesn't make sense
to run more then 2 processes either.
Therefore use a separate executor for each one. The py.test processes will thus
only run in parallel if there are multiple Jenkins executors available.
1 file changed with 26 insertions and 11 deletions:
0 comments (0 inline, 0 general)
Jenkinsfile
Show inline comments
 
def createvirtualenv = ''
 
def activatevirtualenv = ''
 

	
 
node {
 
    def createvirtualenv = ''
 
    def activatevirtualenv = ''
 
    if (isUnix()) {
 
        createvirtualenv = 'rm -r $JENKINS_HOME/venv/$JOB_NAME || true && virtualenv $JENKINS_HOME/venv/$JOB_NAME'
 
        activatevirtualenv = '. $JENKINS_HOME/venv/$JOB_NAME/bin/activate'
 
@@ -61,8 +62,11 @@ node {
 
            echo "Caught: ${exc}"
 
        }
 
    }
 
    def pytests = [:]
 
    pytests['sqlite'] = {
 
}
 

	
 
def pytests = [:]
 
pytests['sqlite'] = {
 
    node {
 
        ws {
 
            deleteDir()
 
            unstash name: 'kallithea'
 
@@ -87,8 +91,11 @@ node {
 
            }
 
        }
 
    }
 
    if (isUnix()) {
 
        pytests['de'] = {
 
}
 

	
 
pytests['de'] = {
 
    node {
 
        if (isUnix()) {
 
            ws {
 
                deleteDir()
 
                unstash name: 'kallithea'
 
@@ -113,7 +120,11 @@ node {
 
                junit 'pytest_de.xml'
 
            }
 
        }
 
        pytests['mysql'] = {
 
    }
 
}
 
pytests['mysql'] = {
 
    node {
 
        if (isUnix()) {
 
            ws {
 
                deleteDir()
 
                unstash name: 'kallithea'
 
@@ -136,7 +147,11 @@ node {
 
                junit 'pytest_mysql.xml'
 
            }
 
        }
 
        pytests['postgresql'] = {
 
    }
 
}
 
pytests['postgresql'] = {
 
    node {
 
        if (isUnix()) {
 
            ws {
 
                deleteDir()
 
                unstash name: 'kallithea'
 
@@ -160,7 +175,7 @@ node {
 
            }
 
        }
 
    }
 
    stage('Tests') {
 
        parallel pytests
 
    }
 
}
 
stage('Tests') {
 
    parallel pytests
 
}
0 comments (0 inline, 0 general)