use of com.axway.ats.log.model.LoadQueueResult in project ats-framework by Axway.
the class DistributedLoadExecutor method waitUntilQueueFinishOnAllLoaders.
private void waitUntilQueueFinishOnAllLoaders() {
try {
log.info("Action queue '" + queueName + "' is running on " + atsAgents.toString());
for (int i = 0; i < atsAgents.size(); i++) {
String host = atsAgents.get(i);
log.info("Waiting until queue '" + queueName + "' finish on '" + host + "'");
AgentService agentServicePort = AgentServicePool.getInstance().getClient(host);
agentServicePort.waitUntilQueueFinish(queueName);
log.info("Finished executing action queue '" + queueName + "' on '" + host + "'");
}
// the queue finished but there might be some failed actions
// check if the wanted actions pass rate is met
LoadQueueResult queueResult = getQueueResult(threadingPattern.getQueuePassRate(), atsAgents);
TestcaseStateEventsDispacher.getInstance().setQueueFinishedAsFailed(queueResult == LoadQueueResult.FAILED);
// end the queue in the log
log.endLoadQueue(queueName, queueResult);
log.info("Finished executing action queue '" + queueName + "' on all agents " + atsAgents.toString());
} catch (Exception e) {
String msg = "Error waiting for action queue '" + queueName + "' completion";
log.error(msg, e);
log.endLoadQueue(queueName, LoadQueueResult.FAILED);
cancelAllActions();
throw new RuntimeException(msg, e);
}
}
use of com.axway.ats.log.model.LoadQueueResult in project ats-framework by Axway.
the class DistributedLoadExecutor method runSynchedIterations.
// TODO When running non blocking, this method is started from a dedicated thread,
// so throwing an error does not affect the main test execution thread,
// so the test does not fail.
// We can keep this errors in some structure which can be checked when
// closing the test case, so we can fail it when needed
private void runSynchedIterations() {
List<String> atsAgentsTmp = new ArrayList<String>(atsAgents);
// the actions queue is running, control its execution
try {
while (true) {
Iterator<String> agentsIterator = atsAgentsTmp.iterator();
while (agentsIterator.hasNext()) {
AgentService agentServicePort = AgentServicePool.getInstance().getClient(agentsIterator.next());
boolean needToRunAgain = agentServicePort.waitUntilQueueIsPaused(queueName);
if (!needToRunAgain) {
agentsIterator.remove();
}
}
if (atsAgentsTmp.size() == 0) {
break;
}
// resume the actions on all agents
for (String agent : atsAgentsTmp) {
AgentService agentServicePort = AgentServicePool.getInstance().getClient(agent);
agentServicePort.resumeQueue(queueName);
}
}
// the queue finished but there might be some failed actions
// check if the wanted actions pass rate is met
LoadQueueResult queueResult = getQueueResult(threadingPattern.getQueuePassRate(), atsAgents);
TestcaseStateEventsDispacher.getInstance().setQueueFinishedAsFailed(queueResult == LoadQueueResult.FAILED);
// end the queue in the log
log.endLoadQueue(queueName, queueResult);
log.info("Finished executing action queue '" + queueName + "' on " + atsAgents.toString() + " with synchronized iterations");
} catch (Exception e) {
String msg = "Error running action queue '" + queueName + "'";
log.error(msg, e);
log.endLoadQueue(queueName, LoadQueueResult.FAILED);
cancelAllActions();
throw new RuntimeException(msg, e);
}
}
Aggregations