Search in sources :

Example 1 with WorkerParameters

use of com.hazelcast.simulator.agent.workerprocess.WorkerParameters in project hazelcast-simulator by hazelcast.

the class Registry method printLayout.

public String printLayout() {
    StringBuilder sb = new StringBuilder();
    sb.append(HORIZONTAL_RULER).append('\n');
    sb.append("Cluster layout").append('\n');
    sb.append(HORIZONTAL_RULER).append('\n');
    for (AgentData agent : agents) {
        Set<String> agentVersionSpecs = agent.getVersionSpecs();
        int agentMemberWorkerCount = agent.getCount("member");
        int agentClientWorkerCount = agent.getWorkers().size() - agentMemberWorkerCount;
        int totalWorkerCount = agentMemberWorkerCount + agentClientWorkerCount;
        String message = "    Agent %s (%s) members: %s, clients: %s";
        if (totalWorkerCount > 0) {
            message += ", version specs: %s";
        } else {
            message += " (no workers)";
        }
        sb.append(format(message, agent.formatIpAddresses(), agent.getAddress(), formatLong(agentMemberWorkerCount, 2), formatLong(agentClientWorkerCount, 2), agentVersionSpecs)).append('\n');
        for (WorkerData worker : agent.getWorkers()) {
            WorkerParameters parameters = worker.getParameters();
            sb.append("        Worker ").append(worker.getAddress()).append(" ").append(parameters.getWorkerType()).append(" [").append(parameters.get("VERSION_SPEC")).append("]").append('\n');
        }
    }
    List<TestData> tests = new ArrayList<TestData>(this.tests.values());
    sb.append(format("    Tests %s", tests.size())).append('\n');
    for (TestData test : tests) {
        sb.append("        ").append(test.getTestCase().getId()).append(" ").append(test.getStatusString()).append('\n');
    }
    return sb.toString();
}
Also used : ArrayList(java.util.ArrayList) WorkerParameters(com.hazelcast.simulator.agent.workerprocess.WorkerParameters)

Example 2 with WorkerParameters

use of com.hazelcast.simulator.agent.workerprocess.WorkerParameters in project hazelcast-simulator by hazelcast.

the class DeploymentPlan method addToPlan.

public DeploymentPlan addToPlan(int workerCount, String workerType) {
    for (int i = 0; i < workerCount; i++) {
        WorkersPerAgent workersPerAgent = nextAgent(workerType);
        AgentData agent = workersPerAgent.agent;
        WorkerParameters workerParameters = vendorDriver.loadWorkerParameters(workerType, agent.getAddressIndex());
        workersPerAgent.registerWorker(workerParameters);
        List<WorkerParameters> workerParametersList = workerDeployment.get(agent.getAddress());
        workerParametersList.add(workerParameters);
    }
    return this;
}
Also used : AgentData(com.hazelcast.simulator.coordinator.registry.AgentData) WorkerParameters(com.hazelcast.simulator.agent.workerprocess.WorkerParameters)

Example 3 with WorkerParameters

use of com.hazelcast.simulator.agent.workerprocess.WorkerParameters in project hazelcast-simulator by hazelcast.

the class DeploymentPlanTest method assertDeploymentPlanWorkerCount.

private void assertDeploymentPlanWorkerCount(DeploymentPlan plan, SimulatorAddress agentAddress, int memberCount, int clientCount) {
    List<WorkerParameters> settingsList = plan.getWorkerDeployment().get(agentAddress);
    assertNotNull(format("Could not find WorkerParameters for Agent %s , workerDeployment: %s", agentAddress, plan.getWorkerDeployment()), settingsList);
    int actualMemberWorkerCount = 0;
    int actualClientWorkerCount = 0;
    for (WorkerParameters workerProcessSettings : settingsList) {
        if (workerProcessSettings.getWorkerType().equals("member")) {
            actualMemberWorkerCount++;
        } else {
            actualClientWorkerCount++;
        }
    }
    String prefix = format("Agent %s members: %d clients: %d", agentAddress, actualMemberWorkerCount, actualClientWorkerCount);
    assertEquals(prefix + " (memberWorkerCount)", memberCount, actualMemberWorkerCount);
    assertEquals(prefix + " (clientWorkerCount)", clientCount, actualClientWorkerCount);
}
Also used : WorkerParameters(com.hazelcast.simulator.agent.workerprocess.WorkerParameters)

Example 4 with WorkerParameters

use of com.hazelcast.simulator.agent.workerprocess.WorkerParameters in project hazelcast-simulator by hazelcast.

the class RegistryTest method testAddWorkers.

@Test
public void testAddWorkers() {
    SimulatorAddress agentAddress = addAgent();
    List<WorkerParameters> parametersList = newWorkerParametersList(agentAddress, 10);
    assertEquals(0, registry.workerCount());
    registry.addWorkers(parametersList);
    assertEquals(10, registry.workerCount());
}
Also used : WorkerParameters(com.hazelcast.simulator.agent.workerprocess.WorkerParameters) SimulatorAddress(com.hazelcast.simulator.protocol.core.SimulatorAddress) Test(org.junit.Test)

Example 5 with WorkerParameters

use of com.hazelcast.simulator.agent.workerprocess.WorkerParameters in project hazelcast-simulator by hazelcast.

the class RegistryTest method testHasClientWorkers_withoutClientWorkers.

@Test
public void testHasClientWorkers_withoutClientWorkers() {
    SimulatorAddress agentAddress = addAgent();
    List<WorkerParameters> parametersList = newWorkerParametersList(agentAddress, 2);
    registry.addWorkers(parametersList);
    assertFalse(registry.hasClientWorkers());
}
Also used : WorkerParameters(com.hazelcast.simulator.agent.workerprocess.WorkerParameters) SimulatorAddress(com.hazelcast.simulator.protocol.core.SimulatorAddress) Test(org.junit.Test)

Aggregations

WorkerParameters (com.hazelcast.simulator.agent.workerprocess.WorkerParameters)18 Test (org.junit.Test)9 SimulatorAddress (com.hazelcast.simulator.protocol.core.SimulatorAddress)8 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 Map (java.util.Map)3 AgentData (com.hazelcast.simulator.coordinator.registry.AgentData)2 File (java.io.File)2 List (java.util.List)2 HazelcastInstance (com.hazelcast.core.HazelcastInstance)1 CreateWorkerOperation (com.hazelcast.simulator.agent.operations.CreateWorkerOperation)1 FailureOperation (com.hazelcast.simulator.coordinator.operations.FailureOperation)1 Registry (com.hazelcast.simulator.coordinator.registry.Registry)1 ThreadSpawner (com.hazelcast.simulator.utils.ThreadSpawner)1 Arrays.asList (java.util.Arrays.asList)1 LinkedList (java.util.LinkedList)1 Ignite (org.apache.ignite.Ignite)1 Before (org.junit.Before)1