use of com.axway.ats.agent.webapp.client.executors.DistributedLoadExecutor in project ats-framework by Axway.
the class ActionQueue method waitUntilQueueFinish.
/**
* Wait until the specified queue finish
*
* @param queueName
* @throws AgentException
*/
@PublicAtsApi
public static void waitUntilQueueFinish(String queueName) throws AgentException {
for (ActionQueue queue : queueInstances) {
if (queue.name.equals(queueName) && !queue.isQueueFinished) {
DistributedLoadExecutor distributedLoadExecutor = new DistributedLoadExecutor(queue.name, queue.sequence, new ArrayList<String>(queue.atsAgents), null, null);
distributedLoadExecutor.waitUntilQueueFinish();
queue.isQueueFinished = true;
return;
}
}
throw new AgentException("Queue with name '" + queueName + "' not found");
}
use of com.axway.ats.agent.webapp.client.executors.DistributedLoadExecutor in project ats-framework by Axway.
the class ActionQueue method waitUntilAllQueuesFinish.
/**
* Wait until all queues finish
*
* @throws AgentException
*/
@PublicAtsApi
public static void waitUntilAllQueuesFinish() throws AgentException {
for (ActionQueue queue : queueInstances) {
if (!queue.isQueueFinished) {
DistributedLoadExecutor distributedLoadExecutor = new DistributedLoadExecutor(queue.name, queue.sequence, new ArrayList<String>(queue.atsAgents), null, null);
distributedLoadExecutor.waitUntilQueueFinish();
queue.isQueueFinished = true;
}
}
}
use of com.axway.ats.agent.webapp.client.executors.DistributedLoadExecutor in project ats-framework by Axway.
the class ActionQueue method cancelQueue.
/**
* Cancel a running queue
*
* @param queueName the name of the queue
* @throws AgentException if no such queue is found
*/
@PublicAtsApi
public static void cancelQueue(String queueName) throws AgentException {
for (ActionQueue queue : queueInstances) {
if (queue.name.equals(queueName) && !queue.isQueueFinished) {
DistributedLoadExecutor distributedLoadExecutor = new DistributedLoadExecutor(queue.name, queue.sequence, new ArrayList<String>(queue.atsAgents), null, null);
distributedLoadExecutor.cancelAllActions();
queue.isQueueFinished = true;
return;
}
}
throw new AgentException("Queue with name '" + queueName + "' not found");
}
use of com.axway.ats.agent.webapp.client.executors.DistributedLoadExecutor in project ats-framework by Axway.
the class ActionQueue method executeQueuedActions.
/**
* Execute all queued actions in multiple threads
*
* @param atsAgents the hosts to execute to
* @param threadingPattern the multithreading pattern
* @param loaderDataConfig the loader variable data configuration
* @throws AgentException on error
*/
public void executeQueuedActions(List<String> atsAgents, ThreadingPattern threadingPattern, LoaderDataConfig loaderDataConfig) throws AgentException {
if (threadingPattern == null) {
throw new AgentException("Threading pattern is not specified. You must specify one");
}
isQueueFinished = false;
//create an empty instance of the config
if (loaderDataConfig == null) {
loaderDataConfig = new LoaderDataConfig();
}
if (atsAgents == null || atsAgents.size() == 0) {
//local execution
LocalLoadExecutor localLoadExecutor = new LocalLoadExecutor(name, sequence, threadingPattern, loaderDataConfig);
localLoadExecutor.executeActions(queuedActions);
} else {
if (threadingPattern.getThreadCount() < atsAgents.size()) {
String firstHost = atsAgents.get(0);
log.warn("The total number of threads [" + threadingPattern.getThreadCount() + "] is less than the number of remote execution hosts [" + atsAgents.size() + "], so all threads will be run on just one host [" + firstHost + "]");
atsAgents = new ArrayList<String>();
atsAgents.add(firstHost);
}
//distributed remote execution
DistributedLoadExecutor distributedLoadExecutor = new DistributedLoadExecutor(name, sequence, atsAgents, threadingPattern, loaderDataConfig);
distributedLoadExecutor.executeActions(queuedActions);
}
if (threadingPattern.isBlockUntilCompletion()) {
isQueueFinished = true;
}
inQueueMode = false;
}
Aggregations