use of com.hazelcast.simulator.agent.workerprocess.WorkerParameters in project hazelcast-simulator by hazelcast.
the class CoordinatorCliTest method count.
private int count(DeploymentPlan deploymentPlan, String workerType) {
Map<SimulatorAddress, List<WorkerParameters>> deployment = deploymentPlan.getWorkerDeployment();
int result = 0;
for (List<WorkerParameters> list : deployment.values()) {
for (WorkerParameters settings : list) {
if (settings.getWorkerType().equals(workerType)) {
result++;
}
}
}
return result;
}
use of com.hazelcast.simulator.agent.workerprocess.WorkerParameters in project hazelcast-simulator by hazelcast.
the class FailureCollectorTest method before.
@Before
public void before() {
outputDirectory = TestUtils.createTmpDirectory();
registry = new Registry();
failureCollector = new FailureCollector(outputDirectory, registry);
agentAddress = registry.addAgent("192.168.0.1", "192.168.0.1").getAddress();
workerAddress = workerAddress(agentAddress.getAgentIndex(), 1);
WorkerParameters workerParameters = new WorkerParameters().set("WORKER_ADDRESS", workerAddress);
registry.addWorkers(singletonList(workerParameters));
exceptionFailure = new FailureOperation("exception", WORKER_EXCEPTION, workerAddress, agentAddress.toString(), "workerId", "testId", null);
abnormalExitFailure = new FailureOperation("exception", WORKER_ABNORMAL_EXIT, workerAddress, agentAddress.toString(), "workerId", "testId", null);
oomeFailure = new FailureOperation("oom", WORKER_OOME, workerAddress, agentAddress.toString(), "workerId", "testId", null);
normalExitFailure = new FailureOperation("finished", WORKER_NORMAL_EXIT, workerAddress, agentAddress.toString(), "workerId", "testId", null);
}
use of com.hazelcast.simulator.agent.workerprocess.WorkerParameters in project hazelcast-simulator by hazelcast.
the class HazelcastDriverTest method test.
@Test
public void test() throws Exception {
VendorDriver<HazelcastInstance> driverAtCoordinator = new HazelcastDriver().setAll(simulatorProperties.asPublicMap()).setAgents(singletonList(agent)).set("CONFIG", fileAsText(localResourceDirectory() + "/hazelcast.xml"));
WorkerParameters workerParameters = driverAtCoordinator.loadWorkerParameters("member", agent.getAddressIndex());
for (Map.Entry<String, String> entry : workerParameters.entrySet()) {
String key = entry.getKey();
if (key.startsWith("file:")) {
writeText(entry.getValue(), new File(getUserDir(), key.substring(5, key.length())));
}
}
VendorDriver<HazelcastInstance> driverAtWorker = new HazelcastDriver().setAll(workerParameters.asMap());
driverAtWorker.startVendorInstance();
HazelcastInstance hz = driverAtWorker.getVendorInstance();
assertNotNull(hz);
driverAtWorker.close();
}
use of com.hazelcast.simulator.agent.workerprocess.WorkerParameters in project hazelcast-simulator by hazelcast.
the class Registry method addWorkers.
public synchronized List<WorkerData> addWorkers(List<WorkerParameters> workerParametersList, Map<String, String> tags) {
List<WorkerData> result = new ArrayList<WorkerData>(workerParametersList.size());
for (WorkerParameters workerParameters : workerParametersList) {
WorkerData worker = new WorkerData(workerParameters, tags);
AgentData agent = agents.get(worker.getAddress().getAgentIndex() - 1);
agent.addWorker(worker);
agent.updateWorkerIndex(worker.getAddress().getAddressIndex());
workers.add(worker);
result.add(worker);
}
return result;
}
use of com.hazelcast.simulator.agent.workerprocess.WorkerParameters in project hazelcast-simulator by hazelcast.
the class StartWorkersTask method startWorkers.
private void startWorkers(Map<SimulatorAddress, List<WorkerParameters>> deploymentPlan) {
ThreadSpawner spawner = new ThreadSpawner("createWorkers", true);
for (Map.Entry<SimulatorAddress, List<WorkerParameters>> entry : deploymentPlan.entrySet()) {
SimulatorAddress agentAddress = entry.getKey();
AgentData agent = registry.getAgent(agentAddress);
for (WorkerParameters workerParameters : entry.getValue()) {
spawner.spawn(new CreateWorkerOnAgentTask(workerParameters, startupDelayMs * workerStartupIndex, agent));
workerStartupIndex++;
}
}
spawner.awaitCompletion();
}
Aggregations