Search in sources :

Example 1 with DistributedLoadExecutor

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");
}
Also used : DistributedLoadExecutor(com.axway.ats.agent.webapp.client.executors.DistributedLoadExecutor) AgentException(com.axway.ats.agent.core.exceptions.AgentException) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 2 with DistributedLoadExecutor

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;
        }
    }
}
Also used : DistributedLoadExecutor(com.axway.ats.agent.webapp.client.executors.DistributedLoadExecutor) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 3 with DistributedLoadExecutor

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");
}
Also used : DistributedLoadExecutor(com.axway.ats.agent.webapp.client.executors.DistributedLoadExecutor) AgentException(com.axway.ats.agent.core.exceptions.AgentException) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 4 with DistributedLoadExecutor

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;
}
Also used : DistributedLoadExecutor(com.axway.ats.agent.webapp.client.executors.DistributedLoadExecutor) AgentException(com.axway.ats.agent.core.exceptions.AgentException) LocalLoadExecutor(com.axway.ats.agent.webapp.client.executors.LocalLoadExecutor) LoaderDataConfig(com.axway.ats.agent.core.threading.data.config.LoaderDataConfig)

Aggregations

DistributedLoadExecutor (com.axway.ats.agent.webapp.client.executors.DistributedLoadExecutor)4 AgentException (com.axway.ats.agent.core.exceptions.AgentException)3 PublicAtsApi (com.axway.ats.common.PublicAtsApi)3 LoaderDataConfig (com.axway.ats.agent.core.threading.data.config.LoaderDataConfig)1 LocalLoadExecutor (com.axway.ats.agent.webapp.client.executors.LocalLoadExecutor)1