Search in sources :

Example 11 with AgentData

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

the class AgentsFile method save.

public static void save(File agentsFile, Registry registry) {
    StringBuilder sb = new StringBuilder();
    for (AgentData agent : registry.getAgents()) {
        String publicAddress = agent.getPublicAddress();
        String privateAddress = agent.getPrivateAddress();
        if (publicAddress.equals(privateAddress)) {
            sb.append(publicAddress);
        } else {
            sb.append(publicAddress).append(',').append(privateAddress);
        }
        Map<String, String> tags = agent.getTags();
        if (!tags.isEmpty()) {
            sb.append('|').append(tagsToString(tags));
        }
        sb.append(NEW_LINE);
    }
    writeText(sb.toString(), agentsFile);
}
Also used : AgentData(com.hazelcast.simulator.coordinator.registry.AgentData) TagUtils.tagsToString(com.hazelcast.simulator.utils.TagUtils.tagsToString)

Example 12 with AgentData

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

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

the class HazelcastDriverTest method before.

@Before
public void before() {
    simulatorProperties = new SimulatorProperties();
    agent = new AgentData(1, SimulatorUtils.localIp(), SimulatorUtils.localIp());
}
Also used : AgentData(com.hazelcast.simulator.coordinator.registry.AgentData) SimulatorProperties(com.hazelcast.simulator.common.SimulatorProperties) Before(org.junit.Before)

Example 14 with AgentData

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

the class DeploymentPlanTest method testGetVersionSpecs_noWorkersOnSecondAgent.

@Test
public void testGetVersionSpecs_noWorkersOnSecondAgent() {
    AgentData agent1 = new AgentData(1, "172.16.16.1", "127.0.0.1");
    AgentData agent2 = new AgentData(2, "172.16.16.2", "127.0.0.1");
    testGetVersionSpecs(asList(agent1, agent2), 1, 0);
}
Also used : AgentData(com.hazelcast.simulator.coordinator.registry.AgentData) Test(org.junit.Test)

Example 15 with AgentData

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

the class Wizard method sshConnectionCheck.

void sshConnectionCheck(SimulatorProperties simulatorProperties, Bash bash) {
    if (isLocal(simulatorProperties)) {
        throw new CommandLineExitException("SSH is not supported for local setups.");
    }
    Registry registry = loadComponentRegister(agentFile, true);
    String userName = simulatorProperties.getUser();
    for (AgentData agent : registry.getAgents()) {
        String publicAddress = agent.getPublicAddress();
        echo("Connecting to %s@%s...", userName, publicAddress);
        bash.ssh(publicAddress, "echo ok 2>&1");
    }
    echo("Connected successfully to all remote machines!");
}
Also used : CommandLineExitException(com.hazelcast.simulator.utils.CommandLineExitException) AgentData(com.hazelcast.simulator.coordinator.registry.AgentData) Registry(com.hazelcast.simulator.coordinator.registry.Registry)

Aggregations

AgentData (com.hazelcast.simulator.coordinator.registry.AgentData)32 Test (org.junit.Test)10 Registry (com.hazelcast.simulator.coordinator.registry.Registry)7 ThreadSpawner (com.hazelcast.simulator.utils.ThreadSpawner)5 CommandLineExitException (com.hazelcast.simulator.utils.CommandLineExitException)3 WorkerParameters (com.hazelcast.simulator.agent.workerprocess.WorkerParameters)2 SimulatorProperties (com.hazelcast.simulator.common.SimulatorProperties)2 AgentData.publicAddressesString (com.hazelcast.simulator.coordinator.registry.AgentData.publicAddressesString)2 BashCommand (com.hazelcast.simulator.utils.BashCommand)2 VendorDriver (com.hazelcast.simulator.vendors.VendorDriver)2 File (java.io.File)2 ArrayList (java.util.ArrayList)2 LinkedList (java.util.LinkedList)2 List (java.util.List)2 Map (java.util.Map)2 Before (org.junit.Before)2 ConfigFileTemplate (com.hazelcast.simulator.coordinator.ConfigFileTemplate)1 WorkerData (com.hazelcast.simulator.coordinator.registry.WorkerData)1 SimulatorAddress (com.hazelcast.simulator.protocol.core.SimulatorAddress)1 FileUtils.ensureExistingFile (com.hazelcast.simulator.utils.FileUtils.ensureExistingFile)1