Search in sources :

Example 6 with WorkerData

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);
    }
}
Also used : WorkerData(com.hazelcast.simulator.coordinator.registry.WorkerData) SimulatorAddress(com.hazelcast.simulator.protocol.core.SimulatorAddress)

Example 7 with WorkerData

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;
}
Also used : HashMap(java.util.HashMap) Future(java.util.concurrent.Future) WorkerData(com.hazelcast.simulator.coordinator.registry.WorkerData)

Example 8 with WorkerData

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);
}
Also used : Future(java.util.concurrent.Future) WorkerData(com.hazelcast.simulator.coordinator.registry.WorkerData) StartPhaseOperation(com.hazelcast.simulator.worker.operations.StartPhaseOperation)

Example 9 with WorkerData

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);
}
Also used : KillWorkersTask(com.hazelcast.simulator.coordinator.tasks.KillWorkersTask) WorkerData(com.hazelcast.simulator.coordinator.registry.WorkerData) WorkerQuery(com.hazelcast.simulator.coordinator.registry.WorkerQuery)

Example 10 with WorkerData

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);
}
Also used : AgentData(com.hazelcast.simulator.coordinator.registry.AgentData) WorkerData(com.hazelcast.simulator.coordinator.registry.WorkerData) VendorDriver.loadVendorDriver(com.hazelcast.simulator.vendors.VendorDriver.loadVendorDriver) VendorDriver(com.hazelcast.simulator.vendors.VendorDriver)

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