Search in sources :

Example 6 with SimulatorAddress

use of com.hazelcast.simulator.protocol.core.SimulatorAddress in project hazelcast-simulator by hazelcast.

the class CoordinatorRemoteCli method loadAddresses.

private static List<String> loadAddresses(OptionSet options, OptionSpec<String> spec, AddressLevel addressLevel) {
    String addresses = options.valueOf(spec);
    if (addresses == null) {
        return null;
    }
    List<String> result = new LinkedList<String>();
    for (String addressString : addresses.split(",")) {
        if (addressString != null) {
            SimulatorAddress address;
            try {
                address = SimulatorAddress.fromString(addressString);
            } catch (Exception e) {
                throw new CommandLineExitException("Worker address [" + addressString + "] is not a valid simulator address", e);
            }
            if (!address.getAddressLevel().equals(addressLevel)) {
                throw new CommandLineExitException("address [" + addressString + "] is not a valid " + addressLevel + " address, it's a " + address.getAddressLevel() + " address");
            }
        }
        result.add(addressString);
    }
    return result;
}
Also used : CommandLineExitException(com.hazelcast.simulator.utils.CommandLineExitException) SimulatorAddress(com.hazelcast.simulator.protocol.core.SimulatorAddress) LinkedList(java.util.LinkedList) CommandLineExitException(com.hazelcast.simulator.utils.CommandLineExitException) NotBoundException(java.rmi.NotBoundException) MalformedURLException(java.net.MalformedURLException) RemoteException(java.rmi.RemoteException)

Example 7 with SimulatorAddress

use of com.hazelcast.simulator.protocol.core.SimulatorAddress in project hazelcast-simulator by hazelcast.

the class WorkerProcessFailureHandler method handle.

public void handle(String message, FailureType type, WorkerProcess workerProcess, String testId, String cause) {
    SimulatorAddress workerAddress = workerProcess.getAddress();
    String workerId = workerProcess.getId();
    FailureOperation failure = new FailureOperation(message, type, workerAddress, agentAddress, workerId, testId, cause);
    if (type.isPoisonPill()) {
        LOGGER.info(format("Worker %s (%s) finished.", workerId, workerAddress));
    } else {
        LOGGER.error(format("Detected failure on Worker %s (%s): %s", workerId, workerAddress, failure.getLogMessage(++failureCount)));
    }
    server.sendCoordinator(failure);
}
Also used : SimulatorAddress(com.hazelcast.simulator.protocol.core.SimulatorAddress) FailureOperation(com.hazelcast.simulator.coordinator.operations.FailureOperation)

Example 8 with SimulatorAddress

use of com.hazelcast.simulator.protocol.core.SimulatorAddress in project hazelcast-simulator by hazelcast.

the class PerformanceStatsCollectorTest method testCalculatePerformanceStats_differentTests.

@Test
public void testCalculatePerformanceStats_differentTests() {
    PerformanceStats a1w1Stats = new PerformanceStats(100, 10, 100.0, 50, 100, 200);
    PerformanceStats a1w2Stats = new PerformanceStats(200, 20, 200.0, 60, 110, 210);
    update(a1w1, TEST_CASE_ID_1, a1w1Stats);
    update(a1w2, TEST_CASE_ID_2, a1w2Stats);
    PerformanceStats a2w1Stats = new PerformanceStats(300, 30, 300.0, 70, 120, 220);
    PerformanceStats a2w2Stats = new PerformanceStats(400, 40, 400.0, 80, 120, 230);
    update(a2w1, TEST_CASE_ID_1, a2w1Stats);
    update(a2w2, TEST_CASE_ID_2, a2w2Stats);
    PerformanceStats totalStats = new PerformanceStats();
    Map<SimulatorAddress, PerformanceStats> agentStats = new HashMap<SimulatorAddress, PerformanceStats>();
    performanceStatsCollector.calculatePerformanceStats(TEST_CASE_ID_1, totalStats, agentStats);
    assertEquals(2, agentStats.size());
    assertPerfStatEquals(a1w1Stats, agentStats.get(a1));
    assertPerfStatEquals(a2w1Stats, agentStats.get(a2));
    assertPerfStatEquals(aggregateAll(a1w1Stats, a2w1Stats), totalStats);
}
Also used : PerformanceStats(com.hazelcast.simulator.worker.performance.PerformanceStats) HashMap(java.util.HashMap) SimulatorAddress(com.hazelcast.simulator.protocol.core.SimulatorAddress) Test(org.junit.Test)

Example 9 with SimulatorAddress

use of com.hazelcast.simulator.protocol.core.SimulatorAddress in project hazelcast-simulator by hazelcast.

the class PerformanceStatsCollectorTest method testCalculatePerformanceStats.

@Test
public void testCalculatePerformanceStats() {
    PerformanceStats a1w1Stats = new PerformanceStats(100, 10, 100.0, 50, 100, 200);
    PerformanceStats a1w2Stats = new PerformanceStats(200, 20, 200.0, 60, 110, 210);
    update(a1w1, TEST_CASE_ID_1, a1w1Stats);
    update(a1w2, TEST_CASE_ID_1, a1w2Stats);
    PerformanceStats a2w1Stats = new PerformanceStats(300, 30, 300.0, 70, 120, 220);
    PerformanceStats a2w2Stats = new PerformanceStats(400, 40, 400.0, 80, 120, 230);
    update(a2w1, TEST_CASE_ID_1, a2w1Stats);
    update(a2w2, TEST_CASE_ID_1, a2w2Stats);
    PerformanceStats totalStats = new PerformanceStats();
    Map<SimulatorAddress, PerformanceStats> agentStats = new HashMap<SimulatorAddress, PerformanceStats>();
    performanceStatsCollector.calculatePerformanceStats(TEST_CASE_ID_1, totalStats, agentStats);
    assertEquals(2, agentStats.size());
    assertPerfStatEquals(aggregateAll(a1w1Stats, a1w2Stats), agentStats.get(a1));
    assertPerfStatEquals(aggregateAll(a2w1Stats, a2w2Stats), agentStats.get(a2));
    assertPerfStatEquals(aggregateAll(a1w1Stats, a1w2Stats, a2w1Stats, a2w2Stats), totalStats);
}
Also used : PerformanceStats(com.hazelcast.simulator.worker.performance.PerformanceStats) HashMap(java.util.HashMap) SimulatorAddress(com.hazelcast.simulator.protocol.core.SimulatorAddress) Test(org.junit.Test)

Example 10 with SimulatorAddress

use of com.hazelcast.simulator.protocol.core.SimulatorAddress in project hazelcast-simulator by hazelcast.

the class PerformanceStatsCollectorTest method testCalculatePerformanceStats_onEmptyContainer.

@Test
public void testCalculatePerformanceStats_onEmptyContainer() {
    PerformanceStats totalPerformanceStats = new PerformanceStats();
    Map<SimulatorAddress, PerformanceStats> agentPerformanceStatsMap = new HashMap<SimulatorAddress, PerformanceStats>();
    emptyPerformanceStatsCollector.calculatePerformanceStats("foo", totalPerformanceStats, agentPerformanceStatsMap);
    assertEquals(0, agentPerformanceStatsMap.size());
    assertTrue(totalPerformanceStats.isEmpty());
}
Also used : PerformanceStats(com.hazelcast.simulator.worker.performance.PerformanceStats) HashMap(java.util.HashMap) SimulatorAddress(com.hazelcast.simulator.protocol.core.SimulatorAddress) Test(org.junit.Test)

Aggregations

SimulatorAddress (com.hazelcast.simulator.protocol.core.SimulatorAddress)30 Test (org.junit.Test)20 WorkerParameters (com.hazelcast.simulator.agent.workerprocess.WorkerParameters)8 HashMap (java.util.HashMap)8 Future (java.util.concurrent.Future)7 PerformanceStats (com.hazelcast.simulator.worker.performance.PerformanceStats)6 List (java.util.List)5 LogOperation (com.hazelcast.simulator.protocol.operation.LogOperation)4 SimulatorOperation (com.hazelcast.simulator.protocol.operation.SimulatorOperation)4 ExecutionException (java.util.concurrent.ExecutionException)4 CreateWorkerOperation (com.hazelcast.simulator.agent.operations.CreateWorkerOperation)3 Map (java.util.Map)3 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)3 JMSException (javax.jms.JMSException)3 FailureOperation (com.hazelcast.simulator.coordinator.operations.FailureOperation)2 AssertTask (com.hazelcast.simulator.utils.AssertTask)2 ArrayList (java.util.ArrayList)2 LinkedList (java.util.LinkedList)2 ConcurrentMap (java.util.concurrent.ConcurrentMap)2 AgentData (com.hazelcast.simulator.coordinator.registry.AgentData)1