How to use getCurrentlyRunning method of org.cerberus.engine.queuemanagement.impl.ExecutionThreadPoolService class

Best Cerberus-source code snippet using org.cerberus.engine.queuemanagement.impl.ExecutionThreadPoolService.getCurrentlyRunning

Source:ExecutionThreadPoolService.java Github

copy

Full Screen

...88 public void setInstanceActive(boolean instanceActive) {89 this.instanceActive = instanceActive;90 }91 @Override92 public HashMap<String, Integer> getCurrentlyRunning() throws CerberusException {93 AnswerList<TestCaseExecutionQueueToTreat> answer = new AnswerList<>();94 HashMap<String, Integer> constrains_current = new HashMap<>();95 // Getting all executions already running in the queue.96 answer = tceiqService.readQueueRunning();97 List<TestCaseExecutionQueueToTreat> executionsRunning = answer.getDataList();98 // Calculate constrain values.99 for (TestCaseExecutionQueueToTreat exe : executionsRunning) {100 String const01_key = TestCaseExecutionQueueToTreat.CONSTRAIN1_GLOBAL;101 String const02_key = TestCaseExecutionQueueToTreat.CONSTRAIN2_APPLIENV + CONST_SEPARATOR + exe.getSystem() + CONST_SEPARATOR + exe.getEnvironment() + CONST_SEPARATOR + exe.getCountry() + CONST_SEPARATOR + exe.getApplication();102 String const03_key = TestCaseExecutionQueueToTreat.CONSTRAIN3_APPLICATION + CONST_SEPARATOR + exe.getApplication();103 String const04_key = TestCaseExecutionQueueToTreat.CONSTRAIN4_ROBOT + CONST_SEPARATOR + exe.getSelectedRobotHost();104 if (constrains_current.containsKey(const01_key)) {105 constrains_current.put(const01_key, constrains_current.get(const01_key) + 1);106 } else {107 constrains_current.put(const01_key, 1);108 }109 if (constrains_current.containsKey(const02_key)) {110 constrains_current.put(const02_key, constrains_current.get(const02_key) + 1);111 } else {112 constrains_current.put(const02_key, 1);113 }114 if (constrains_current.containsKey(const03_key)) {115 constrains_current.put(const03_key, constrains_current.get(const03_key) + 1);116 } else {117 constrains_current.put(const03_key, 1);118 }119 if (constrains_current.containsKey(const04_key)) {120 constrains_current.put(const04_key, constrains_current.get(const04_key) + 1);121 } else {122 constrains_current.put(const04_key, 1);123 }124 }125 return constrains_current;126 }127 @Override128 public HashMap<String, Integer> getCurrentlyPoolSizes() throws CerberusException {129 AnswerList<TestCaseExecutionQueueToTreat> answer = new AnswerList<>();130 HashMap<String, Integer> constrains_current = new HashMap<>();131 String const01_key = TestCaseExecutionQueueToTreat.CONSTRAIN1_GLOBAL;132 int poolSizeGeneral = parameterService.getParameterIntegerByKey("cerberus_queueexecution_global_threadpoolsize", "", 12);133 int poolSizeRobot = parameterService.getParameterIntegerByKey("cerberus_queueexecution_defaultrobothost_threadpoolsize", "", 10);134 constrains_current.put(const01_key, poolSizeGeneral);135 // Getting RobotHost PoolSize136 HashMap<String, Integer> robot_poolsize = new HashMap<String, Integer>();137 robot_poolsize = invariantService.readToHashMapGp1IntegerByIdname("ROBOTHOST", poolSizeRobot);138 // Getting all executions to be treated.139 answer = tceiqService.readQueueToTreatOrRunning();140 List<TestCaseExecutionQueueToTreat> executionsToTreat = answer.getDataList();141 // Calculate constrain values.142 for (TestCaseExecutionQueueToTreat exe : executionsToTreat) {143 String const02_key = TestCaseExecutionQueueToTreat.CONSTRAIN2_APPLIENV + CONST_SEPARATOR + exe.getSystem() + CONST_SEPARATOR + exe.getEnvironment() + CONST_SEPARATOR + exe.getCountry() + CONST_SEPARATOR + exe.getApplication();144 String const03_key = TestCaseExecutionQueueToTreat.CONSTRAIN3_APPLICATION + CONST_SEPARATOR + exe.getApplication();145 String const04_key = TestCaseExecutionQueueToTreat.CONSTRAIN4_ROBOT + CONST_SEPARATOR + exe.getSelectedRobotHost();146 constrains_current.put(const02_key, exe.getPoolSizeAppEnvironment());147 constrains_current.put(const03_key, exe.getPoolSizeApplication());148 // Getting Robot Host PoolSize from invariant hashmap.149 int robot_poolsize_final = 0;150 if (!StringUtil.isNullOrEmpty(exe.getSelectedRobotHost())) {151 if (robot_poolsize.containsKey(exe.getSelectedRobotHost())) {152 robot_poolsize_final = ParameterParserUtil.parseIntegerParam(robot_poolsize.get(exe.getSelectedRobotHost()), poolSizeRobot);153 } else {154 robot_poolsize_final = poolSizeRobot;155 }156 }157 constrains_current.put(const04_key, robot_poolsize_final);158 }159 return constrains_current;160 }161 @Override162 public HashMap<String, Integer> getCurrentlyToTreat() throws CerberusException {163 AnswerList<TestCaseExecutionQueueToTreat> answer = new AnswerList<>();164 HashMap<String, Integer> constrains_current = new HashMap<String, Integer>();165 // Getting all executions to be treated.166 answer = tceiqService.readQueueToTreat();167 List<TestCaseExecutionQueueToTreat> executionsToTreat = answer.getDataList();168 // Calculate constrain values.169 for (TestCaseExecutionQueueToTreat exe : executionsToTreat) {170 String const01_key = TestCaseExecutionQueueToTreat.CONSTRAIN1_GLOBAL;171 String const02_key = TestCaseExecutionQueueToTreat.CONSTRAIN2_APPLIENV + CONST_SEPARATOR + exe.getSystem() + CONST_SEPARATOR + exe.getEnvironment() + CONST_SEPARATOR + exe.getCountry() + CONST_SEPARATOR + exe.getApplication();172 String const03_key = TestCaseExecutionQueueToTreat.CONSTRAIN3_APPLICATION + CONST_SEPARATOR + exe.getApplication();173 String const04_key = TestCaseExecutionQueueToTreat.CONSTRAIN4_ROBOT + CONST_SEPARATOR + exe.getQueueRobotHost();174 if (constrains_current.containsKey(const01_key)) {175 constrains_current.put(const01_key, constrains_current.get(const01_key) + 1);176 } else {177 constrains_current.put(const01_key, 1);178 }179 if (constrains_current.containsKey(const02_key)) {180 constrains_current.put(const02_key, constrains_current.get(const02_key) + 1);181 } else {182 constrains_current.put(const02_key, 1);183 }184 if (constrains_current.containsKey(const03_key)) {185 constrains_current.put(const03_key, constrains_current.get(const03_key) + 1);186 } else {187 constrains_current.put(const03_key, 1);188 }189 if (constrains_current.containsKey(const04_key)) {190 constrains_current.put(const04_key, constrains_current.get(const04_key) + 1);191 } else {192 constrains_current.put(const04_key, 1);193 }194 }195 return constrains_current;196 }197 /**198 * {@inheritDoc}199 */200 @Override201 public void executeNextInQueue(boolean forceExecution) throws CerberusException {202 if (!instanceActive) {203 LOG.warn("Queue execution disable on that JVM instance.");204 return;205 }206 // Job can be desactivated by parameter.207 if (!(parameterService.getParameterBooleanByKey("cerberus_queueexecution_enable", "", true))) {208 LOG.debug("Queue_Processing_Job disabled by parameter : 'cerberus_queueexecution_enable'.");209 return;210 }211 // We first check that another thread of Cerberus already trigger the job. Only 1 instance of the job is necessary.212 if (!(myVersionService.getMyVersionStringByKey("queueprocessingjobrunning", "N").equals("Y"))213 || forceExecution) {214 // Flag in database that job is already running.215 if (myVersionService.flagMyVersionString("queueprocessingjobrunning") || forceExecution) {216 // Saving the timestamps when the job start in database.217 myVersionService.updateMyVersionString("queueprocessingjobstart", String.valueOf(new Date()));218 if (forceExecution) {219 LOG.debug("Forcing Start of Queue_Processing_Job.");220 }221 int nbqueuedexe = 0;222 // We try to submit new jobs until the job does not trigger any new execution.223 // In Other Words : As long as the job trigger new execution, we execute it.224 do {225 if (!(parameterService.getParameterBooleanByKey("cerberus_queueexecution_enable", "", true))) {226 LOG.debug("Queue_Processing_Job disabled by parameter : 'cerberus_queueexecution_enable'.");227 return;228 }229 nbqueuedexe = 0;230 // Job is not already running, we can trigger it.231 LOG.debug("Starting Queue_Processing_Job.");232 // Getting all executions to be treated.233 AnswerList<TestCaseExecutionQueueToTreat> answer = new AnswerList<>();234 answer = tceiqService.readQueueToTreat();235 List<TestCaseExecutionQueueToTreat> executionsInQueue = answer.getDataList();236 int poolSizeGeneral = 12;237 int poolSizeRobot = 10;238 int queueTimeout = 600000;239 // Init constrain counter (from list of already running execution.).240 int const01_current = 0;241 int const02_current = 0;242 int const03_current = 0;243 int const04_current = 0;244 HashMap<String, Integer> constrains_current = new HashMap<>();245 HashMap<String, Integer> robothost_poolsize = new HashMap<>();246 HashMap<String, List<RobotExecutor>> robot_executor = new HashMap<>();247 HashMap<String, Robot> robot_header = new HashMap<>();248 if (!executionsInQueue.isEmpty()) {249 poolSizeGeneral = parameterService.getParameterIntegerByKey("cerberus_queueexecution_global_threadpoolsize", "", 12);250 poolSizeRobot = parameterService.getParameterIntegerByKey("cerberus_queueexecution_defaultrobothost_threadpoolsize", "", 10);251 queueTimeout = parameterService.getParameterIntegerByKey("cerberus_queueexecution_timeout", "", 600000);252 // Init constrain counter (from list of already running execution.).253 const01_current = 0;254 const02_current = 0;255 const03_current = 0;256 const04_current = 0;257 constrains_current = getCurrentlyRunning();258 LOG.debug("Current Constrains : " + constrains_current);259 // Getting RobotHost PoolSize260 robothost_poolsize = invariantService.readToHashMapGp1IntegerByIdname("ROBOTHOST", poolSizeRobot);261 // Getting the list of robot in scope of the queue entries. This is to avoid getting all robots from database.262 LOG.debug("Getting List of Robot Executor.");263 for (TestCaseExecutionQueueToTreat exe : executionsInQueue) {264 if (!StringUtil.isNullOrEmpty(exe.getQueueRobot())) {265 robot_executor.put(exe.getQueueRobot(), new ArrayList<>());266 }267 }268 LOG.debug("List of Robot from Queue entries : " + robot_executor);269 robot_executor = robotExecutorService.getExecutorListFromRobotHash(robot_executor);270 LOG.debug("Robot Executor List : " + robot_executor);271 LOG.debug("Getting List of Robot (Header).");...

Full Screen

Full Screen

getCurrentlyRunning

Using AI Code Generation

copy

Full Screen

1import org.cerberus.engine.queuemanagement.impl.ExecutionThreadPoolService;2import org.cerberus.engine.queuemanagement.entity.ExecutionThreadPool;3ExecutionThreadPoolService executionThreadPoolService = ExecutionThreadPoolService.getInstance();4ExecutionThreadPool executionThreadPool = executionThreadPoolService.getCurrentlyRunning();5if (executionThreadPool != null) {6 System.out.println(executionThreadPool.getTest() + " " + executionThreadPool.getTestCase());7} else {8 System.out.println("No test case is running");9}10import org.cerberus.engine.queuemanagement.impl.ExecutionThreadPoolService;11import org.cerberus.engine.queuemanagement.entity.ExecutionThreadPool;12ExecutionThreadPoolService executionThreadPoolService = ExecutionThreadPoolService.getInstance();13ExecutionThreadPool executionThreadPool = executionThreadPoolService.getCurrentlyRunning();14if (executionThreadPool != null) {15 System.out.println(executionThreadPool.getTest() + " " + executionThreadPool.getTestCase());16} else {17 System.out.println("No test case is running");18}19import org.cerberus.engine.queuemanagement.impl.ExecutionThreadPoolService;20import org.cerberus.engine.queuemanagement.entity.ExecutionThreadPool;21ExecutionThreadPoolService executionThreadPoolService = ExecutionThreadPoolService.getInstance();22ExecutionThreadPool executionThreadPool = executionThreadPoolService.getCurrentlyRunning();23if (executionThreadPool != null) {24 System.out.println(executionThreadPool.getTest() + " " + executionThreadPool.getTestCase());25} else {26 System.out.println("No test case is running");27}28import org.cerberus.engine.queuemanagement.impl.ExecutionThreadPoolService;29import org.cerberus.engine.queuemanagement.entity.ExecutionThreadPool;30ExecutionThreadPoolService executionThreadPoolService = ExecutionThreadPoolService.getInstance();31ExecutionThreadPool executionThreadPool = executionThreadPoolService.getCurrentlyRunning();32if (executionThreadPool != null) {33 System.out.println(executionThreadPool.getTest() + " " + executionThreadPool.getTestCase());34} else {

Full Screen

Full Screen

getCurrentlyRunning

Using AI Code Generation

copy

Full Screen

1ExecutionThreadPoolService etsp = new ExecutionThreadPoolService();2etsp.getCurrentlyRunning()3ExecutionThreadPoolService etsp = new ExecutionThreadPoolService();4etsp.getCurrentlyRunning()5at script1567565275572224840645.run(script1567565275572224840645.groovy:1)6at groovy.lang.GroovyShell.evaluate(GroovyShell.java:585)7at groovy.lang.GroovyShell.evaluate(GroovyShell.java:623)8at groovy.lang.GroovyShell.evaluate(GroovyShell.java:594)9at groovy.ui.GroovyMain.processOnce(GroovyMain.java:652)10at groovy.ui.GroovyMain.run(GroovyMain.java:376)11at groovy.ui.GroovyMain.process(GroovyMain.java:365)12at groovy.ui.GroovyMain.processArgs(GroovyMain.java:134)13at groovy.ui.GroovyMain.main(GroovyMain.java:119)14at java.net.URLClassLoader.findClass(URLClassLoader.java:381)15at java.lang.ClassLoader.loadClass(ClassLoader.java:424)16at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)17at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

Full Screen

Full Screen

getCurrentlyRunning

Using AI Code Generation

copy

Full Screen

1import org.cerberus.engine.queuemanagement.impl.ExecutionThreadPoolService2import org.cerberus.engine.entity.MessageEvent3import org.cerberus.engine.entity.MessageGeneral4import org.cerberus.engine.execution.impl.TestSuiteExecution5import org.cerberus.engine.execution.impl.TestCaseExecution6import org.cerberus.engine.entity.ExecutionThreadPool7def executionThreadPoolService = ExecutionThreadPoolService.getInstance()8def executionThreadPool = executionThreadPoolService.getExecutionThreadPool()9def currentlyRunning = executionThreadPoolService.getCurrentlyRunning()10def queued = executionThreadPoolService.getQueue()11def currentlyRunningTestCases = currentlyRunning.collect { it.testCase }12def queuedTestCases = queued.collect { it.testCase }13def currentlyRunningTestSuites = currentlyRunning.collect { it.testSuite }14def queuedTestSuites = queued.collect { it.testSuite }15def testCaseExecution = new TestCaseExecution()16def testSuiteExecution = new TestSuiteExecution()17def currentlyRunningTestCasesAndSuitesWithExecutionId = currentlyRunningTestCasesAndSuites.collect { testCaseExecution.getExecutionId(it) }18def queuedTestCasesAndSuitesWithExecutionId = queuedTestCasesAndSuites.collect { testCaseExecution.getExecutionId(it) }19def currentlyRunningTestCasesAndSuitesWithExecutionIdAndTest = currentlyRunningTestCasesAndSuitesWithExecutionId.collect { testCaseExecution.getTest(it) }20def queuedTestCasesAndSuitesWithExecutionIdAndTest = queuedTestCasesAndSuitesWithExecutionId.collect { testCaseExecution.getTest(it) }21def currentlyRunningTestCasesAndSuitesWithExecutionIdAndTestAndTestCase = currentlyRunningTestCasesAndSuitesWithExecutionIdAndTest.collect { testCaseExecution.getTestCase(it) }22def queuedTestCasesAndSuitesWithExecutionIdAndTestAndTestCase = queuedTestCasesAndSuitesWithExecutionIdAndTest.collect { testCaseExecution.getTestCase(it) }23def currentlyRunningTestCasesAndSuitesWithExecutionIdAndTestAndTestCaseAndApplication = currentlyRunningTestCasesAndSuitesWithExecutionIdAndTestAndTestCase.collect { testCase

Full Screen

Full Screen

getCurrentlyRunning

Using AI Code Generation

copy

Full Screen

1import org.cerberus.engine.queuemanagement.impl.ExecutionThreadPoolService2def instance = ExecutionThreadPoolService.getInstance()3def running = instance.getCurrentlyRunning()4log.info("Currently running: ${running}")5import org.cerberus.engine.queuemanagement.impl.ExecutionThreadPoolService6def instance = ExecutionThreadPoolService.getInstance()7def running = instance.getRunningExecutions()8log.info("Running executions: ${running}")9import org.cerberus.engine.queuemanagement.impl.ExecutionThreadPoolService10def instance = ExecutionThreadPoolService.getInstance()11def queued = instance.getQueuedExecutions()12log.info("Queued executions: ${queued}")13import org.cerberus.engine.queuemanagement.impl.ExecutionThreadPoolService14def instance = ExecutionThreadPoolService.getInstance()15def pending = instance.getPendingExecutions()16log.info("Pending executions: ${pending}")17import org.cerberus.engine.queuemanagement.impl.ExecutionThreadPoolService18def instance = ExecutionThreadPoolService.getInstance()19def error = instance.getErrorExecutions()20log.info("Error executions: ${error}")21import org.cerberus.engine.queuemanagement.impl.ExecutionThreadPoolService22def instance = ExecutionThreadPoolService.getInstance()23def warning = instance.getWarningExecutions()24log.info("Warning executions: ${warning}")

Full Screen

Full Screen

getCurrentlyRunning

Using AI Code Generation

copy

Full Screen

1import org.cerberus.engine.queuemanagement.impl.ExecutionThreadPoolService2import org.cerberus.engine.entity.ExecutionThreadPool3import org.cerberus.engine.entity.ExecutionThreadPoolStatus4def executionThreadPoolService = ExecutionThreadPoolService.getInstance()5def runningExecutions = executionThreadPoolService.getCurrentlyRunning()6def queuedExecutions = executionThreadPoolService.getExecutionInQueue()7def executionsInError = executionThreadPoolService.getExecutionInError()8def runningExecutionsIds = runningExecutions.collect { it.executionId }9def queuedExecutionsIds = queuedExecutions.collect { it.executionId }10def executionsInErrorIds = executionsInError.collect { it.executionId }11def runningExecutionsCount = runningExecutions.size()12def queuedExecutionsCount = queuedExecutions.size()13def executionsInErrorCount = executionsInError.size()14def runningExecutionsIdsCount = runningExecutionsIds.size()15def queuedExecutionsIdsCount = queuedExecutionsIds.size()16def executionsInErrorIdsCount = executionsInErrorIds.size()17def runningExecutionsIdsString = runningExecutionsIds.join(", ")18def queuedExecutionsIdsString = queuedExecutionsIds.join(", ")19def executionsInErrorIdsString = executionsInErrorIds.join(", ")20def runningExecutionsString = runningExecutions.join(", ")21def queuedExecutionsString = queuedExecutions.join(", ")22def executionsInErrorString = executionsInError.join(", ")23def runningExecutionsIdsString = runningExecutionsIds.join(", ")24def queuedExecutionsIdsString = queuedExecutionsIds.join(", ")25def executionsInErrorIdsString = executionsInErrorIds.join(", ")26def runningExecutionsIdsString = runningExecutionsIds.join(", ")27def queuedExecutionsIdsString = queuedExecutionsIds.join(", ")28def executionsInErrorIdsString = executionsInErrorIds.join(", ")29def runningExecutionsIdsString = runningExecutionsIds.join(", ")30def queuedExecutionsIdsString = queuedExecutionsIds.join(", ")

Full Screen

Full Screen

getCurrentlyRunning

Using AI Code Generation

copy

Full Screen

1import org.cerberus.engine.queuemanagement.impl.ExecutionThreadPoolService;2import org.cerberus.engine.entity.MessageEvent;3import java.util.concurrent.CopyOnWriteArrayList;4import java.util.ArrayList;5import java.util.List;6CopyOnWriteArrayList<MessageEvent> runningTestCases = ExecutionThreadPoolService.getInstance().getCurrentlyRunning();7List<String> runningTestCasesList = new ArrayList<String>();8for (MessageEvent runningTestCase : runningTestCases) {9 runningTestCasesList.add(runningTestCase.getTest());10}11return runningTestCasesList;

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Cerberus-source automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful