diff --git a/test-salt-formulas-env.groovy b/test-salt-formulas-env.groovy
index 1f646b9..4edcdb7 100644
--- a/test-salt-formulas-env.groovy
+++ b/test-salt-formulas-env.groovy
@@ -19,74 +19,76 @@
 
 def checkouted = false
 
-node("python") {
-  try {
-    stage("checkout") {
-      if (defaultGitRef && defaultGitUrl) {
-        checkouted = gerrit.gerritPatchsetCheckout(defaultGitUrl, defaultGitRef, "HEAD", CREDENTIALS_ID)
-      } else {
-        throw new Exception("Cannot checkout gerrit patchset, DEFAULT_GIT_REF is null")
-      }
-    }
-    stage("cleanup") {
-      if (checkouted) {
-        sh("make clean")
-      }
-    }
-    stage("kitchen") {
-      if (checkouted) {
-        if (fileExists(".kitchen.yml")) {
-          common.infoMsg(".kitchen.yml found, running kitchen tests")
-          ruby.ensureRubyEnv()
-          if (fileExists(".travis.yml")) {
-            common.infoMsg(".travis.yml found, running custom kitchen init")
-            def kitchenConfigYML = readYaml(file: ".travis.yml")
-            def kitchenInit = kitchenConfigYML["install"]
-            def kitchenInstalled = false
-            if (kitchenInit && !kitchenInit.isEmpty()) {
-              for (int i = 0; i < kitchenInit.size(); i++) {
-                if (kitchenInit[i].trim().startsWith("test -e Gemfile")) { //found Gemfile config
-                  common.infoMsg("Custom Gemfile configuration found, using them")
-                  ruby.installKitchen(kitchenInit[i].trim())
-                  kitchenInstalled = true
-                }
-              }
-            }
-            if (!kitchenInstalled) {
-              ruby.installKitchen()
-            }
-          } else {
-            common.infoMsg(".travis.yml not found, running default kitchen init")
-            ruby.installKitchen()
-          }
-          common.infoMsg("Running part of kitchen test")
-          if (KITCHEN_ENV != null && !KITCHEN_ENV.isEmpty() && KITCHEN_ENV != "") {
-            def cleanEnv = KITCHEN_ENV.replaceAll("\\s?SUITE=[^\\s]*", "")
-            def suite = ruby.getSuiteName(KITCHEN_ENV)
-            if (suite && suite != "") {
-              common.infoMsg("Running kitchen test with environment:" + KITCHEN_ENV.trim())
-              ruby.runKitchenTests(cleanEnv, suite)
-            } else {
-              common.warningMsg("No SUITE was found. Running with all suites.")
-              ruby.runKitchenTests(cleanEnv, "")
-            }
-          } else {
-            throw new Exception("KITCHEN_ENV parameter is empty or invalid. This may indicate wrong env settings of initial test job or .travis.yml file.")
-          }
+throttle(['test-formula']) {
+  node("python") {
+    try {
+      stage("checkout") {
+        if (defaultGitRef && defaultGitUrl) {
+          checkouted = gerrit.gerritPatchsetCheckout(defaultGitUrl, defaultGitRef, "HEAD", CREDENTIALS_ID)
         } else {
-          throw new Exception(".kitchen.yml file not found, no kitchen tests triggered.")
+          throw new Exception("Cannot checkout gerrit patchset, DEFAULT_GIT_REF is null")
         }
       }
-    }
-  } catch (Throwable e) {
-    // If there was an error or exception thrown, the build failed
-    currentBuild.result = "FAILURE"
-    ruby.runKitchenCommand("destroy")
-    throw e
-  } finally {
-    if (currentBuild.result == "FAILURE" && fileExists(".kitchen/logs/kitchen.log")) {
-      common.errorMsg("----------------KITCHEN LOG:---------------")
-      println readFile(".kitchen/logs/kitchen.log")
+      stage("cleanup") {
+        if (checkouted) {
+          sh("make clean")
+        }
+      }
+      stage("kitchen") {
+        if (checkouted) {
+          if (fileExists(".kitchen.yml")) {
+            common.infoMsg(".kitchen.yml found, running kitchen tests")
+            ruby.ensureRubyEnv()
+            if (fileExists(".travis.yml")) {
+              common.infoMsg(".travis.yml found, running custom kitchen init")
+              def kitchenConfigYML = readYaml(file: ".travis.yml")
+              def kitchenInit = kitchenConfigYML["install"]
+              def kitchenInstalled = false
+              if (kitchenInit && !kitchenInit.isEmpty()) {
+                for (int i = 0; i < kitchenInit.size(); i++) {
+                  if (kitchenInit[i].trim().startsWith("test -e Gemfile")) { //found Gemfile config
+                    common.infoMsg("Custom Gemfile configuration found, using them")
+                    ruby.installKitchen(kitchenInit[i].trim())
+                    kitchenInstalled = true
+                  }
+                }
+              }
+              if (!kitchenInstalled) {
+                ruby.installKitchen()
+              }
+            } else {
+              common.infoMsg(".travis.yml not found, running default kitchen init")
+              ruby.installKitchen()
+            }
+            common.infoMsg("Running part of kitchen test")
+            if (KITCHEN_ENV != null && !KITCHEN_ENV.isEmpty() && KITCHEN_ENV != "") {
+              def cleanEnv = KITCHEN_ENV.replaceAll("\\s?SUITE=[^\\s]*", "")
+              def suite = ruby.getSuiteName(KITCHEN_ENV)
+              if (suite && suite != "") {
+                common.infoMsg("Running kitchen test with environment:" + KITCHEN_ENV.trim())
+                ruby.runKitchenTests(cleanEnv, suite)
+              } else {
+                common.warningMsg("No SUITE was found. Running with all suites.")
+                ruby.runKitchenTests(cleanEnv, "")
+              }
+            } else {
+              throw new Exception("KITCHEN_ENV parameter is empty or invalid. This may indicate wrong env settings of initial test job or .travis.yml file.")
+            }
+          } else {
+            throw new Exception(".kitchen.yml file not found, no kitchen tests triggered.")
+          }
+        }
+      }
+    } catch (Throwable e) {
+      // If there was an error or exception thrown, the build failed
+      currentBuild.result = "FAILURE"
+      ruby.runKitchenCommand("destroy")
+      throw e
+    } finally {
+      if (currentBuild.result == "FAILURE" && fileExists(".kitchen/logs/kitchen.log")) {
+        common.errorMsg("----------------KITCHEN LOG:---------------")
+        println readFile(".kitchen/logs/kitchen.log")
+      }
     }
   }
 }
diff --git a/test-salt-model-node.groovy b/test-salt-model-node.groovy
index bcc0c8b..eaf0104 100644
--- a/test-salt-model-node.groovy
+++ b/test-salt-model-node.groovy
@@ -23,44 +23,47 @@
 def defaultGitUrl = DEFAULT_GIT_URL
 
 def checkouted = false
-node("python") {
-  try{
-    stage("checkout") {
-      if(defaultGitRef != "" && defaultGitUrl != "") {
-          checkouted = gerrit.gerritPatchsetCheckout(defaultGitUrl, defaultGitRef, "HEAD", CREDENTIALS_ID)
-      } else {
-        throw new Exception("Cannot checkout gerrit patchset, DEFAULT_GIT_URL or DEFAULT_GIT_REF is null")
-      }
-      if(checkouted) {
-        if (fileExists('classes/system')) {
-          if (SYSTEM_GIT_URL == "") {
-            ssh.prepareSshAgentKey(CREDENTIALS_ID)
-            dir('classes/system') {
-              remoteUrl = git.getGitRemote()
-              ssh.ensureKnownHosts(remoteUrl)
-            }
-            ssh.agentSh("git submodule init; git submodule sync; git submodule update --recursive")
-          } else {
-            dir('classes/system') {
-              if (!gerrit.gerritPatchsetCheckout(SYSTEM_GIT_URL, SYSTEM_GIT_REF, "HEAD", CREDENTIALS_ID)) {
-                common.errorMsg("Failed to obtain system reclass with url: ${SYSTEM_GIT_URL} and ${SYSTEM_GIT_REF}")
+
+throttle(['test-model']) {
+  node("python") {
+    try{
+      stage("checkout") {
+        if(defaultGitRef != "" && defaultGitUrl != "") {
+            checkouted = gerrit.gerritPatchsetCheckout(defaultGitUrl, defaultGitRef, "HEAD", CREDENTIALS_ID)
+        } else {
+          throw new Exception("Cannot checkout gerrit patchset, DEFAULT_GIT_URL or DEFAULT_GIT_REF is null")
+        }
+        if(checkouted) {
+          if (fileExists('classes/system')) {
+            if (SYSTEM_GIT_URL == "") {
+              ssh.prepareSshAgentKey(CREDENTIALS_ID)
+              dir('classes/system') {
+                remoteUrl = git.getGitRemote()
+                ssh.ensureKnownHosts(remoteUrl)
+              }
+              ssh.agentSh("git submodule init; git submodule sync; git submodule update --recursive")
+            } else {
+              dir('classes/system') {
+                if (!gerrit.gerritPatchsetCheckout(SYSTEM_GIT_URL, SYSTEM_GIT_REF, "HEAD", CREDENTIALS_ID)) {
+                  common.errorMsg("Failed to obtain system reclass with url: ${SYSTEM_GIT_URL} and ${SYSTEM_GIT_REF}")
+                }
               }
             }
           }
         }
       }
-    }
 
-    stage("test node") {
-      if (checkouted) {
-        def workspace = common.getWorkspace()
-        saltModelTesting.setupAndTestNode(NODE_TARGET, CLUSTER_NAME, EXTRA_FORMULAS, workspace, FORMULAS_SOURCE, FORMULAS_REVISION, MAX_CPU_PER_JOB.toInteger())
+      stage("test node") {
+        if (checkouted) {
+          def workspace = common.getWorkspace()
+          saltModelTesting.setupAndTestNode(NODE_TARGET, CLUSTER_NAME, EXTRA_FORMULAS, workspace, FORMULAS_SOURCE, FORMULAS_REVISION, MAX_CPU_PER_JOB.toInteger())
+        }
       }
+    } catch (Throwable e) {
+       // If there was an error or exception thrown, the build failed
+       currentBuild.result = "FAILURE"
+       currentBuild.description = currentBuild.description ? e.message + " " + currentBuild.description : e.message
+       throw e
     }
-  } catch (Throwable e) {
-     // If there was an error or exception thrown, the build failed
-     currentBuild.result = "FAILURE"
-     currentBuild.description = currentBuild.description ? e.message + " " + currentBuild.description : e.message
-     throw e
   }
 }
