Update getting batch size for cloud deploy and upgrade mcp jobs

Get batch size based on common function which respect all possible ways
of setting batch sizes.

Change-Id: I045814854e92f7267723a5f4bd62509e8c71b71e
Related-Prod: PROD-27850
diff --git a/cloud-deploy-pipeline.groovy b/cloud-deploy-pipeline.groovy
index 0713192..d5b991c 100644
--- a/cloud-deploy-pipeline.groovy
+++ b/cloud-deploy-pipeline.groovy
@@ -356,10 +356,7 @@
             // Install
             //
             if (!batch_size) {
-                def workerThreads = salt.getReturnValues(salt.getPillar(venvPepper, "I@salt:master", "salt:master:worker_threads", null)).toString()
-                if (workerThreads.isInteger() && workerThreads.toInteger() > 0) {
-                   batch_size = workerThreads
-                }
+                batch_size = salt.getWorkerThreads(venvPepper)
             }
 
             // Check if all minions are reachable and ready
diff --git a/upgrade-mcp-release.groovy b/upgrade-mcp-release.groovy
index be354cb..f30cce2 100644
--- a/upgrade-mcp-release.groovy
+++ b/upgrade-mcp-release.groovy
@@ -337,10 +337,7 @@
                 error('Pillar data is broken for Salt master node! Please check it manually and re-run pipeline.')
             }
             if (!batchSize) {
-                def workerThreads = salt.getReturnValues(salt.getPillar(venvPepper, "I@salt:master", "salt:master:worker_threads", null)).toString()
-                if (workerThreads.isInteger() && workerThreads.toInteger() > 0) {
-                   batchSize = workerThreads
-                }
+                batchSize = salt.getWorkerThreads(venvPepper)
             }
 
             stage('Update Reclass and Salt-Formulas') {