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() + "]");
}
}
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;
}
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");
}
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();
}
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));
}
Aggregations