Search in sources :

Example 1 with WorkerQuery

use of com.hazelcast.simulator.coordinator.registry.WorkerQuery 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 2 with WorkerQuery

use of com.hazelcast.simulator.coordinator.registry.WorkerQuery 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 3 with WorkerQuery

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

the class CoordinatorCli method loadTestSuite.

private TestSuite loadTestSuite() {
    TestSuite testSuite = loadRawTestSuite();
    if (testSuite == null) {
        return null;
    }
    WorkerQuery workerQuery = new WorkerQuery().setTargetType(options.valueOf(targetTypeSpec));
    int targetCount = options.valueOf(targetCountSpec);
    if (targetCount > 0) {
        workerQuery.setMaxCount(targetCount);
    }
    int durationSeconds = getDurationSeconds(options, durationSpec);
    testSuite.setDurationSeconds(durationSeconds).setFailFast(options.valueOf(failFastSpec)).setVerifyEnabled(options.valueOf(verifyEnabledSpec)).setParallel(options.has(parallelSpec)).setWorkerQuery(workerQuery);
    // if the coordinator is not monitoring performance, we don't care for measuring latencies
    if (coordinatorParameters.getSimulatorProperties().getInt("WORKER_PERFORMANCE_MONITOR_INTERVAL_SECONDS") == 0) {
        for (TestCase testCase : testSuite.getTestCaseList()) {
            testCase.setProperty("measureLatency", "false");
        }
    }
    return testSuite;
}
Also used : TestCase(com.hazelcast.simulator.common.TestCase) WorkerQuery(com.hazelcast.simulator.coordinator.registry.WorkerQuery)

Aggregations

WorkerQuery (com.hazelcast.simulator.coordinator.registry.WorkerQuery)3 WorkerData (com.hazelcast.simulator.coordinator.registry.WorkerData)2 TestCase (com.hazelcast.simulator.common.TestCase)1 KillWorkersTask (com.hazelcast.simulator.coordinator.tasks.KillWorkersTask)1