Search in sources :

Example 1 with VendorDriver

use of com.hazelcast.simulator.vendors.VendorDriver in project hazelcast-simulator by hazelcast.

the class WorkerTest method before.

@Before
public void before() {
    setupFakeEnvironment();
    Registry registry = new Registry();
    AgentData agent = registry.addAgent(PUBLIC_ADDRESS, PUBLIC_ADDRESS);
    SimulatorProperties properties = new SimulatorProperties().set("MANAGEMENT_CENTER_URL", "none");
    VendorDriver driver = new HazelcastDriver().setAgents(registry.getAgents()).setAll(properties.asPublicMap()).set("CONFIG", fileAsText(localResourceDirectory() + "/hazelcast.xml"));
    workerAddress = workerAddress(AGENT_INDEX, WORKER_INDEX);
    parameters = driver.loadWorkerParameters("member", agent.getAddressIndex()).set("WORKER_ADDRESS", workerAddress).set("PUBLIC_ADDRESS", PUBLIC_ADDRESS);
    for (Map.Entry<String, String> entry : parameters.entrySet()) {
        String key = entry.getKey();
        if (key.startsWith("file:")) {
            FileUtils.writeText(entry.getValue(), new File(getUserDir(), key.substring(5, key.length())));
        }
    }
}
Also used : AgentData(com.hazelcast.simulator.coordinator.registry.AgentData) Registry(com.hazelcast.simulator.coordinator.registry.Registry) VendorDriver(com.hazelcast.simulator.vendors.VendorDriver) HazelcastDriver(com.hazelcast.simulator.vendors.HazelcastDriver) Map(java.util.Map) File(java.io.File) SimulatorProperties(com.hazelcast.simulator.common.SimulatorProperties) Before(org.junit.Before)

Example 2 with VendorDriver

use of com.hazelcast.simulator.vendors.VendorDriver in project hazelcast-simulator by hazelcast.

the class Coordinator method workerStart.

public String workerStart(RcWorkerStartOperation op) throws Exception {
    // todo: tags
    String workerType = op.getWorkerType();
    LOGGER.info("Starting " + op.getCount() + " [" + workerType + "] workers...");
    VendorDriver vendorDriver = loadVendorDriver(properties.get("VENDOR")).setAgents(registry.getAgents()).setAll(properties.asPublicMap()).set("CLIENT_ARGS", op.getVmOptions()).set("MEMBER_ARGS", op.getVmOptions()).set("SESSION_ID", parameters.getSessionId()).setIfNotNull("VERSION_SPEC", op.getVersionSpec()).setIfNotNull("CONFIG", op.getConfig());
    List<AgentData> agents = findAgents(op);
    if (agents.isEmpty()) {
        throw new IllegalStateException("No suitable agents found");
    }
    LOGGER.info("Suitable agents: " + agents);
    DeploymentPlan deploymentPlan = new DeploymentPlan(vendorDriver, agents).addToPlan(op.getCount(), workerType);
    List<WorkerData> workers = createStartWorkersTask(deploymentPlan.getWorkerDeployment(), op.getTags()).run();
    LOGGER.info("Workers started!");
    return WorkerData.toAddressString(workers);
}
Also used : AgentData(com.hazelcast.simulator.coordinator.registry.AgentData) WorkerData(com.hazelcast.simulator.coordinator.registry.WorkerData) VendorDriver.loadVendorDriver(com.hazelcast.simulator.vendors.VendorDriver.loadVendorDriver) VendorDriver(com.hazelcast.simulator.vendors.VendorDriver)

Aggregations

AgentData (com.hazelcast.simulator.coordinator.registry.AgentData)2 VendorDriver (com.hazelcast.simulator.vendors.VendorDriver)2 SimulatorProperties (com.hazelcast.simulator.common.SimulatorProperties)1 Registry (com.hazelcast.simulator.coordinator.registry.Registry)1 WorkerData (com.hazelcast.simulator.coordinator.registry.WorkerData)1 HazelcastDriver (com.hazelcast.simulator.vendors.HazelcastDriver)1 VendorDriver.loadVendorDriver (com.hazelcast.simulator.vendors.VendorDriver.loadVendorDriver)1 File (java.io.File)1 Map (java.util.Map)1 Before (org.junit.Before)1