Search in sources :

Example 1 with WorkerData

use of com.hazelcast.simulator.coordinator.registry.WorkerData in project hazelcast-simulator by hazelcast.

the class KillWorkersTask method killWorkers.

private void killWorkers(List<WorkerData> victims) {
    LOGGER.info(format("Killing [%s]", toAddressString(victims)));
    for (WorkerData victim : victims) {
        victim.setIgnoreFailures(true);
        client.submit(victim.getAddress(), new ExecuteScriptOperation(command, true));
        LOGGER.info("Kill send to worker [" + victim.getAddress() + "]");
    }
}
Also used : WorkerData(com.hazelcast.simulator.coordinator.registry.WorkerData) ExecuteScriptOperation(com.hazelcast.simulator.worker.operations.ExecuteScriptOperation)

Example 2 with WorkerData

use of com.hazelcast.simulator.coordinator.registry.WorkerData in project hazelcast-simulator by hazelcast.

the class RunTestSuiteTask method initTargets.

private List<WorkerData> initTargets() {
    WorkerQuery workerQuery = testSuite.getWorkerQuery();
    List<WorkerData> targets = workerQuery.execute(registry.getWorkers());
    if (targets.isEmpty()) {
        throw new IllegalStateException("No workers found for query: " + workerQuery);
    }
    List<WorkerData> clients = filter(targets, false);
    List<WorkerData> members = filter(targets, true);
    LOGGER.info("Using: " + workerQuery);
    if (members.isEmpty()) {
        LOGGER.info(format("Using %s clients [%s]", clients.size(), toAddressString(clients)));
    } else if (clients.isEmpty()) {
        LOGGER.info(format("Using %s members [%s]", members.size(), toAddressString(members)));
    } else {
        LOGGER.info(format("Using %s clients [%s]", clients.size(), toAddressString(clients)));
        LOGGER.info(format("Using %s members [%s]", members.size(), toAddressString(members)));
    }
    return targets;
}
Also used : WorkerData(com.hazelcast.simulator.coordinator.registry.WorkerData) WorkerQuery(com.hazelcast.simulator.coordinator.registry.WorkerQuery)

Example 3 with WorkerData

use of com.hazelcast.simulator.coordinator.registry.WorkerData in project hazelcast-simulator by hazelcast.

the class TestCaseRunner method stopRun.

private void stopRun() {
    log("Stopping test");
    Map<WorkerData, Future> futures = submitToTargets(false, new StopRunOperation(testCase.getId()));
    try {
        waitForPhaseCompletion(RUN, futures);
        log("Stopping test completed");
    } catch (TestCaseAbortedException e) {
        log(e.getMessage());
    }
    recordTimestamp("stop");
}
Also used : StopRunOperation(com.hazelcast.simulator.worker.operations.StopRunOperation) Future(java.util.concurrent.Future) WorkerData(com.hazelcast.simulator.coordinator.registry.WorkerData)

Example 4 with WorkerData

use of com.hazelcast.simulator.coordinator.registry.WorkerData in project hazelcast-simulator by hazelcast.

the class Coordinator method workerScript.

public String workerScript(RcWorkerScriptOperation operation) throws Exception {
    List<WorkerData> workers = operation.getWorkerQuery().execute(registry.getWorkers());
    LOGGER.info(format("Script [%s] on %s workers ...", operation.getCommand(), workers.size()));
    Map<WorkerData, Future<String>> futures = new HashMap<WorkerData, Future<String>>();
    for (WorkerData worker : workers) {
        Future<String> f = client.submit(worker.getAddress(), new ExecuteScriptOperation(operation.getCommand(), operation.isFireAndForget()));
        futures.put(worker, f);
        LOGGER.info("Script send to worker [" + worker.getAddress() + "]");
    }
    if (operation.isFireAndForget()) {
        return null;
    }
    StringBuilder sb = new StringBuilder();
    for (Map.Entry<WorkerData, Future<String>> entry : futures.entrySet()) {
        WorkerData worker = entry.getKey();
        String result = entry.getValue().get();
        sb.append(worker.getAddress()).append("=").append(result).append("\n");
    }
    LOGGER.info(format("Script [%s] on %s workers completed!", operation.getCommand(), workers.size()));
    return sb.toString();
}
Also used : HashMap(java.util.HashMap) Future(java.util.concurrent.Future) WorkerData(com.hazelcast.simulator.coordinator.registry.WorkerData) ExecuteScriptOperation(com.hazelcast.simulator.worker.operations.ExecuteScriptOperation) Map(java.util.Map) HashMap(java.util.HashMap)

Example 5 with WorkerData

use of com.hazelcast.simulator.coordinator.registry.WorkerData in project hazelcast-simulator by hazelcast.

the class FailureCollectorTest method notify_whenWorkerIgnoresFailure.

private void notify_whenWorkerIgnoresFailure(FailureOperation failure, boolean workerDeleted) {
    WorkerData worker = registry.getWorker(workerAddress);
    worker.setIgnoreFailures(true);
    failureCollector.notify(failure);
    assertEquals(0, failureCollector.getFailureCount());
    assertEquals(workerDeleted ? null : worker, registry.getWorker(workerAddress));
}
Also used : WorkerData(com.hazelcast.simulator.coordinator.registry.WorkerData)

Aggregations

WorkerData (com.hazelcast.simulator.coordinator.registry.WorkerData)13 Future (java.util.concurrent.Future)4 WorkerQuery (com.hazelcast.simulator.coordinator.registry.WorkerQuery)2 ExecuteScriptOperation (com.hazelcast.simulator.worker.operations.ExecuteScriptOperation)2 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 StopTimeoutDetectionOperation (com.hazelcast.simulator.agent.operations.StopTimeoutDetectionOperation)1 AgentData (com.hazelcast.simulator.coordinator.registry.AgentData)1 KillWorkersTask (com.hazelcast.simulator.coordinator.tasks.KillWorkersTask)1 SimulatorAddress (com.hazelcast.simulator.protocol.core.SimulatorAddress)1 VendorDriver (com.hazelcast.simulator.vendors.VendorDriver)1 VendorDriver.loadVendorDriver (com.hazelcast.simulator.vendors.VendorDriver.loadVendorDriver)1 StartPhaseOperation (com.hazelcast.simulator.worker.operations.StartPhaseOperation)1 StopRunOperation (com.hazelcast.simulator.worker.operations.StopRunOperation)1 TerminateWorkerOperation (com.hazelcast.simulator.worker.operations.TerminateWorkerOperation)1 Map (java.util.Map)1