changeset 6583:8a60eb2b7603

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.
author domruf <dominikruf@gmail.com>
date Sun, 09 Apr 2017 00:13:17 +0200
parents 1ae319cb41b1
children f9dc10c33d07
files Jenkinsfile
diffstat 1 files changed, 26 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/Jenkinsfile	Thu Apr 06 16:55:55 2017 +0300
+++ b/Jenkinsfile	Sun Apr 09 00:13:17 2017 +0200
@@ -1,6 +1,7 @@
+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 @@
             echo "Caught: ${exc}"
         }
     }
-    def pytests = [:]
-    pytests['sqlite'] = {
+}
+
+def pytests = [:]
+pytests['sqlite'] = {
+    node {
         ws {
             deleteDir()
             unstash name: 'kallithea'
@@ -87,8 +91,11 @@
             }
         }
     }
-    if (isUnix()) {
-        pytests['de'] = {
+}
+
+pytests['de'] = {
+    node {
+        if (isUnix()) {
             ws {
                 deleteDir()
                 unstash name: 'kallithea'
@@ -113,7 +120,11 @@
                 junit 'pytest_de.xml'
             }
         }
-        pytests['mysql'] = {
+    }
+}
+pytests['mysql'] = {
+    node {
+        if (isUnix()) {
             ws {
                 deleteDir()
                 unstash name: 'kallithea'
@@ -136,7 +147,11 @@
                 junit 'pytest_mysql.xml'
             }
         }
-        pytests['postgresql'] = {
+    }
+}
+pytests['postgresql'] = {
+    node {
+        if (isUnix()) {
             ws {
                 deleteDir()
                 unstash name: 'kallithea'
@@ -160,7 +175,7 @@
             }
         }
     }
-    stage('Tests') {
-        parallel pytests
-    }
 }
+stage('Tests') {
+    parallel pytests
+}