How to use getNbQueueingExecutions method of org.cerberus.servlet.zzpublic.ManageV001 class

Best Cerberus-source code snippet using org.cerberus.servlet.zzpublic.ManageV001.getNbQueueingExecutions

Source:ManageV001.java Github

copy

Full Screen

...103 int maxIteration = parameterService.getParameterIntegerByKey("cerberus_manage_timeout", "", 300);104 int cntIteration = 0;105 int instancePendingExecutionNb = euuid.size();106 int globalPendingExecutionNb = getNbPendingExecutions(appContext);107 int globalQueueingExecutionNb = getNbQueueingExecutions(appContext);108 boolean globalActive = parameterService.getParameterBooleanByKey("cerberus_queueexecution_enable", "", true);109 boolean globalSplashPageActive = parameterService.getParameterBooleanByKey(Parameter.VALUE_cerberus_splashpage_enable, "", true);110 if (request.getParameter("action") != null && request.getParameter("action").equals(ACTIONCLEANMEMORY)) {111 if (request.getParameter("scope") != null && request.getParameter("scope").equals("instance")) {112 logEventService.createForPrivateCalls(SERVLETNAME, "CLEANMEMORY", "Cerberus Instance requested to Garbage collection.", request);113 System.gc();114 message = "Memory Cleaned.";115 returnCode = "OK";116 }117 }118 if (request.getParameter("action") != null && request.getParameter("action").equals(ACTIONPURGECACHE)) {119 logEventService.createForPrivateCalls(SERVLETNAME, "PURGECACHE", "Cerberus Instance requested to Purge Cache.", request);120 //XRay121 xrayService.purgeAllCacheEntries();122 //Parameters123 parameterService.purgeCacheEntry(null);124 //TagSystem125 tagSystemService.purgeTagSystemCache();126 message = "Cache Purged.";127 returnCode = "OK";128 }129 if (request.getParameter("action") != null && request.getParameter("action").equals("runQueueJob")) {130 logEventService.createForPrivateCalls(SERVLETNAME, "RUN", "Queue job requested to run.", request);131 try {132 // Run the Execution pool Job.133 executionThreadPoolService.executeNextInQueueAsynchroneously(false);134 } catch (CerberusException ex) {135 LOG.error("Exception triggering the ThreadPool job.", ex);136 }137 message = "Queue job trigered.";138 returnCode = "OK";139 }140 if (request.getParameter("action") != null && request.getParameter("action").equals("stop")) {141 if (request.getParameter("scope") != null && request.getParameter("scope").equals("instance")) {142 logEventService.createForPrivateCalls(SERVLETNAME, "STOP", "Cerberus Instance requested to stop.", request);143 // ajouter boolean setSplashPageActive144 executionThreadPoolService.setSplashPageActive(true);145 /**146 * We deactivate the instance to process new execution.147 */148 executionThreadPoolService.setInstanceActive(false);149 /**150 * We clean all scheduler entries.151 */152 cerberusScheduler.closeScheduler();153 /**154 * Now that we stopped the submissions of new executions155 * and also stopped the scheduler, no more executions156 * should be triggered on that instance. We now wait a157 * bit until we check the pending executions. Some158 * executions could be submitted but not yet visible159 * from the instance yet.160 */161 Thread.sleep(10000);162 /**163 * We loop every second until maxIteration session in164 * order to wait until no more executions are running on165 * that instance.166 */167 while (instancePendingExecutionNb > 0 && cntIteration <= maxIteration) {168 cntIteration++;169 Thread.sleep(1000);170 instancePendingExecutionNb = euuid.size();171 LOG.info("Stopping instance : Check " + cntIteration + "/" + maxIteration + " on pending executions on that instance. Still running : " + instancePendingExecutionNb);172 }173 data.put("waitedIterations", cntIteration);174 message = "Instance Stopped.";175 returnCode = "OK";176 } else if (request.getParameter("scope") != null && request.getParameter("scope").equals("global")) {177 logEventService.createForPrivateCalls(SERVLETNAME, "STOP", "Cerberus (global system) requested to stop.", request);178 // global splashpage : true => ATTENTION CACHE 60s utiliser short_cache179 parameterService.setParameter("cerberus_splashpage_enable", "", "true");180 /**181 * We deactivate globally the queue processing accross182 * all instances.183 */184 parameterService.setParameter("cerberus_queueexecution_enable", "", "N");185 /**186 * We loop every second until maxIteration session in187 * order to wait until no more executions are running.188 */189 while (globalPendingExecutionNb > 0 && cntIteration <= maxIteration) {190 cntIteration++;191 Thread.sleep(1000);192 // TODO193 globalPendingExecutionNb = getNbPendingExecutions(appContext);194 LOG.info("Stopping global : Check " + cntIteration + "/" + maxIteration + " on global pending executions. Still running : " + globalPendingExecutionNb);195 }196 data.put("waitedIterations", cntIteration);197 message = "Cerberus Stopped.";198 returnCode = "OK";199 } else {200 message += "Parameter 'scope' not defined.";201 returnCode = "KO";202 }203 }204 if (request.getParameter("action") != null && request.getParameter("action").equals("start")) {205 if (request.getParameter("scope") != null && request.getParameter("scope").equals("instance")) {206 logEventService.createForPrivateCalls(SERVLETNAME, "START", "Instance requested to start.", request);207 executionThreadPoolService.setSplashPageActive(false);208 /**209 * We activate the instance to process queue and start210 * new executions.211 */212 executionThreadPoolService.setInstanceActive(true);213 /**214 * We reactivate and force reload all scheduler entries.215 */216 cerberusScheduler.setInstanceSchedulerVersion("INIT");217 cerberusScheduler.init();218 /**219 * We run the execution pool.220 */221 try {222 executionThreadPoolService.executeNextInQueueAsynchroneously(false);223 } catch (CerberusException ex) {224 LOG.error("Exception triggering the ThreadPool job.", ex);225 }226 message = "Instance Started.";227 returnCode = "OK";228 } else if (request.getParameter("scope") != null && request.getParameter("scope").equals("global")) {229 logEventService.createForPrivateCalls(SERVLETNAME, "START", "Cerberus (global system) requested to start.", request);230 // global splashpage : false231 parameterService.setParameter("cerberus_splashpage_enable", "", "false");232 /**233 * We activate the parameter to process queue (that will234 * start new executions).235 */236 parameterService.setParameter("cerberus_queueexecution_enable", "", "Y");237 message = "Cerberus Started.";238 returnCode = "OK";239 } else {240 message += "Scope parameter 'scope' not defined.";241 returnCode = "KO";242 }243 }244 instancePendingExecutionNb = euuid.size();245 globalPendingExecutionNb = getNbPendingExecutions(appContext);246 globalQueueingExecutionNb = getNbQueueingExecutions(appContext);247 globalActive = parameterService.getParameterBooleanByKey("cerberus_queueexecution_enable", "", true);248 globalSplashPageActive = parameterService.getParameterBooleanByKey(Parameter.VALUE_cerberus_splashpage_enable, "", true);249 JSONObject instance = new JSONObject();250 instance.put("active", executionThreadPoolService.isInstanceActive());251 instance.put("runningExecutions", instancePendingExecutionNb);252 instance.put("readyToStop", (instancePendingExecutionNb <= 0));253 instance.put("isSplashPageActive", executionThreadPoolService.isSplashPageActive());254 data.put("instance", instance);255 JSONObject memory = new JSONObject();256 Runtime instance1 = Runtime.getRuntime();257 int mb = 1024 * 1024;258 long usedMem = (instance1.totalMemory() - instance1.freeMemory()) / mb;259 long totalMem = instance1.maxMemory() / mb;260 memory.put("javaFreeMemory", instance1.freeMemory() / mb);261 memory.put("javaTotalMemory", instance1.totalMemory() / mb);262 memory.put("javaUsedMemory", usedMem);263 memory.put("javaMaxMemory", totalMem);264 memory.put("perUsed", usedMem * 100 / totalMem);265 data.put("memory", memory);266 JSONObject global = new JSONObject();267 global.put("active", globalActive);268 global.put("runningExecutions", globalPendingExecutionNb);269 global.put("readyToStop", (globalPendingExecutionNb <= 0));270 global.put("queuedExecutions", globalQueueingExecutionNb);271 global.put("isSplashPageActive", globalSplashPageActive);272 data.put("global", global);273 JSONObject fsSize = new JSONObject();274 fsSize.put("cerberus_exeautomedia_path", getFSSize(parameterService.getParameterStringByKey("cerberus_exeautomedia_path", "", "/")));275 fsSize.put("cerberus_applicationobject_path", getFSSize(parameterService.getParameterStringByKey("cerberus_applicationobject_path", "", "/")));276 fsSize.put("cerberus_exemanualmedia_path", getFSSize(parameterService.getParameterStringByKey("cerberus_exemanualmedia_path", "", "/")));277 fsSize.put("cerberus_ftpfile_path", getFSSize(parameterService.getParameterStringByKey("cerberus_ftpfile_path", "", "/")));278 fsSize.put("cerberus_testdatalibcsv_path", getFSSize(parameterService.getParameterStringByKey("cerberus_testdatalibcsv_path", "", "/")));279 data.put("fileSystemSize", fsSize);280 // Credit Limit Consumption281 JSONObject objCreditLimit = new JSONObject();282 objCreditLimit.put("numberOfExecution", sc.getCreditLimitNbExe());283 objCreditLimit.put("durationOfExecutionInSecond", sc.getCreditLimitSecondExe());284 data.put("creditLimit", objCreditLimit);285 data.put("isSplashPageActive", globalSplashPageActive || executionThreadPoolService.isSplashPageActive());286 data.put("message", message);287 data.put("returnCode", returnCode);288 resultS = data.toString(1);289 response.getWriter().print(resultS);290 }291 } catch (JSONException | InterruptedException ex) {292 LOG.error(ex);293 }294 }295 private int getNbPendingExecutions(ApplicationContext appContext) {296 try {297 tceiqService = appContext.getBean(ITestCaseExecutionQueueService.class);298 // Getting all executions already running in the queue.299 AnswerList<TestCaseExecutionQueueToTreat> answer = tceiqService.readQueueRunning();300 List<TestCaseExecutionQueueToTreat> executionsRunning = answer.getDataList();301 return executionsRunning.size();302 } catch (CerberusException ex) {303 LOG.error(ex);304 }305 return 0;306 }307 private int getNbQueueingExecutions(ApplicationContext appContext) {308 try {309 tceiqService = appContext.getBean(ITestCaseExecutionQueueService.class);310 // Getting all executions already running in the queue.311 AnswerList<TestCaseExecutionQueueToTreat> answer = tceiqService.readQueueToTreat();312 List<TestCaseExecutionQueueToTreat> executionsRunning = answer.getDataList();313 return executionsRunning.size();314 } catch (CerberusException ex) {315 LOG.error(ex);316 }317 return 0;318 }319 private JSONObject getFSSize(String path) {320 JSONObject exeFS = new JSONObject();321 LOG.debug(path);...

Full Screen

Full Screen

getNbQueueingExecutions

Using AI Code Generation

copy

Full Screen

1public int getNbQueueingExecutions(String system, String environment, String country) {2 try {3 return ManageV001.getNbQueueingExecutions(system, environment, country);4 } catch (Exception ex) {5 LOG.error(ex.toString(), ex);6 return -1;7 }8}9public int getNbQueueingExecutions(String system, String environment, String country) {10 try {11 return ManageV001.getNbQueueingExecutions(system, environment, country);12 } catch (Exception ex) {13 LOG.error(ex.toString(), ex);14 return -1;15 }16}17public int getNbQueueingExecutions(String system, String environment, String country) {18 try {19 return ManageV001.getNbQueueingExecutions(system, environment, country);20 } catch (Exception ex) {21 LOG.error(ex.toString(), ex);22 return -1;23 }24}25public int getNbQueueingExecutions(String system, String environment, String country) {26 try {27 return ManageV001.getNbQueueingExecutions(system, environment, country);28 } catch (Exception ex) {29 LOG.error(ex.toString(), ex);30 return -1;31 }32}33public int getNbQueueingExecutions(String system, String environment, String country) {34 try {35 return ManageV001.getNbQueueingExecutions(system, environment, country);36 } catch (Exception ex) {37 LOG.error(ex.toString(), ex);38 return -1;39 }40}41public int getNbQueueingExecutions(String system, String environment, String country) {42 try {43 return ManageV001.getNbQueueingExecutions(system, environment, country);44 } catch (Exception ex) {45 LOG.error(ex.toString(), ex);

Full Screen

Full Screen

getNbQueueingExecutions

Using AI Code Generation

copy

Full Screen

1import org.cerberus.servlet.zzpublic.ManageV001;2import org.cerberus.servlet.zzpublic.ManageV001Service;3import org.cerberus.servlet.zzpublic.ManageV001;4import org.cerberus.servlet.zzpublic.ManageV001Service;5ManageV001Service service = new ManageV001Service();6ManageV001 port = service.getManageV001Port();7System.out.println("Number of queued executions: " + port.getNbQueueingExecutions());

Full Screen

Full Screen

getNbQueueingExecutions

Using AI Code Generation

copy

Full Screen

1package org.cerberus.servlet.zzpublic;2import org.cerberus.engine.entity.MessageEvent;3import org.cerberus.engine.entity.MessageGeneral;4import org.cerberus.engine.execution.IExecutionQueueService;5import org.cerberus.engine.execution.impl.ExecutionQueueService;6import org.cerberus.engine.threadpool.IExecutionThreadPoolService;7import org.cerberus.engine.threadpool.impl.ExecutionThreadPoolService;8import org.cerberus.exception.CerberusException;9import org.cerberus.log.MyLogger;10import org.cerberus.servlet.api.IApiService;11import org.cerberus.servlet.api.ILogApiService;12import org.cerberus.servlet.api.impl.ApiService;13import org.cerberus.servlet.api.impl.LogApiService;14import org.cerberus.util.answer.AnswerItem;15import org.cerberus.util.answer.AnswerList;16import org.json.JSONArray;17import org.json.JSONException;18import org.json.JSONObject;19import org.springframework.context.ApplicationContext;20import org.springframework.context.support.ClassPathXmlApplicationContext;21import javax.servlet.ServletException;22import javax.servlet.http.HttpServlet;23import javax.servlet.http.HttpServletRequest;24import javax.servlet.http.HttpServletResponse;25import java.io.IOException;26import java.io.PrintWriter;27import java.util.List;28public class ManageV001 extends HttpServlet {29 private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(ManageV001.class);30 private static final String API_VERSION = "1.0.0";31 private static final String API_NAME = "Manage";32 private static final String API_CONTEXT_ROOT = "manage";33 private static final String API_DESCRIPTION = "This API is used to manage Cerberus.";34 private static final String API_LIST = "list";35 private static final String API_GET = "get";36 private static final String API_GETQUEUE = "getQueue";

Full Screen

Full Screen

getNbQueueingExecutions

Using AI Code Generation

copy

Full Screen

1var nbQueueingExecutions = getNbQueueingExecutions();2$('#nbQueueingExecutions').html(nbQueueingExecutions);3function getNbQueueingExecutions() {4 var nbQueueingExecutions = 0;5 $.ajax({6 success: function (data) {7 nbQueueingExecutions = data.nbQueueingExecutions;8 }9 });10 return nbQueueingExecutions;11}

Full Screen

Full Screen

getNbQueueingExecutions

Using AI Code Generation

copy

Full Screen

1int nbQueueingExecutions = org.cerberus.servlet.zzpublic.ManageV001.getNbQueueingExecutions();2if (nbQueueingExecutions > 0) {3 out.println("There is " + nbQueueingExecutions + " execution(s) in queue.");4}5if (nbQueueingExecutions == 0) {6 out.println("There is no execution in queue.");7}8if (nbQueueingExecutions == -1) {9 out.println("Error while getting the number of executions in queue.");10}

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