use of com.hazelcast.simulator.coordinator.registry.WorkerData in project hazelcast-simulator by hazelcast.
the class FailureCollector method notify.
public void notify(FailureOperation failure) {
failure = enrich(failure);
SimulatorAddress workerAddress = failure.getWorkerAddress();
if (workerAddress != null && failure.getType() != WORKER_CREATE_ERROR) {
WorkerData worker = registry.findWorker(workerAddress);
if (worker == null) {
// we are not interested in failures of workers that aren't registered any longer.
return;
}
// if the failure is the terminal for that workers, we need to remove it from the component registry
if (failure.getType().isTerminal()) {
LOGGER.info("Removing worker " + worker.getAddress() + " from registry due to [" + failure.getType() + "]");
registry.removeWorker(worker.getAddress());
}
// if we don't care for the failure, we are done; no need to log anything.
if (worker.isIgnoreFailures() || failure.getType() == WORKER_NORMAL_EXIT) {
return;
}
}
int failureCount = criticalFailureCounter.incrementAndGet();
String testId = failure.getTestId();
if (testId != null) {
hasCriticalFailuresMap.put(testId, true);
}
logFailure(failure, failureCount);
appendText(failure.getFileMessage(), file);
for (FailureListener failureListener : listenerMap.keySet()) {
failureListener.onFailure(failure, failure.getType().isTerminal(), true);
}
}
use of com.hazelcast.simulator.coordinator.registry.WorkerData in project hazelcast-simulator by hazelcast.
the class TestCaseRunner method submitToTargets.
private Map<WorkerData, Future> submitToTargets(boolean singleTarget, SimulatorOperation op) {
Map<WorkerData, Future> futures = new HashMap<WorkerData, Future>();
if (singleTarget) {
Future f = client.submit(globalTarget.getAddress(), op);
futures.put(globalTarget, f);
} else {
for (WorkerData worker : targets) {
Future f = client.submit(worker.getAddress(), op);
futures.put(worker, f);
}
}
return futures;
}
use of com.hazelcast.simulator.coordinator.registry.WorkerData in project hazelcast-simulator by hazelcast.
the class TestCaseRunner method executePhase.
private void executePhase(TestPhase phase) {
if (hasFailure()) {
throw new TestCaseAbortedException("Skipping Test " + phase.desc() + " (critical failure)", phase);
}
log("Starting Test " + phase.desc());
test.setTestPhase(phase);
Map<WorkerData, Future> futures = submitToTargets(phase.isGlobal(), new StartPhaseOperation(phase, testCase.getId()));
waitForPhaseCompletion(phase, futures);
log("Completed Test " + phase.desc());
waitForGlobalTestPhaseCompletion(phase);
}
use of com.hazelcast.simulator.coordinator.registry.WorkerData in project hazelcast-simulator by hazelcast.
the class Coordinator method workerKill.
public String workerKill(RcWorkerKillOperation op) throws Exception {
WorkerQuery workerQuery = op.getWorkerQuery();
LOGGER.info(format("Killing %s...", workerQuery));
List<WorkerData> result = new KillWorkersTask(registry, client, op.getCommand(), workerQuery, properties.getInt("WAIT_FOR_WORKER_SHUTDOWN_TIMEOUT_SECONDS")).run();
LOGGER.info("\n" + registry.printLayout());
LOGGER.info(format("Killing %s complete", workerQuery));
return WorkerData.toAddressString(result);
}
use of com.hazelcast.simulator.coordinator.registry.WorkerData in project hazelcast-simulator by hazelcast.
the class Coordinator method workerStart.
public String workerStart(RcWorkerStartOperation op) throws Exception {
// todo: tags
String workerType = op.getWorkerType();
LOGGER.info("Starting " + op.getCount() + " [" + workerType + "] workers...");
VendorDriver vendorDriver = loadVendorDriver(properties.get("VENDOR")).setAgents(registry.getAgents()).setAll(properties.asPublicMap()).set("CLIENT_ARGS", op.getVmOptions()).set("MEMBER_ARGS", op.getVmOptions()).set("SESSION_ID", parameters.getSessionId()).setIfNotNull("VERSION_SPEC", op.getVersionSpec()).setIfNotNull("CONFIG", op.getConfig());
List<AgentData> agents = findAgents(op);
if (agents.isEmpty()) {
throw new IllegalStateException("No suitable agents found");
}
LOGGER.info("Suitable agents: " + agents);
DeploymentPlan deploymentPlan = new DeploymentPlan(vendorDriver, agents).addToPlan(op.getCount(), workerType);
List<WorkerData> workers = createStartWorkersTask(deploymentPlan.getWorkerDeployment(), op.getTags()).run();
LOGGER.info("Workers started!");
return WorkerData.toAddressString(workers);
}
Aggregations