Search in sources :

Example 1 with BashCommand

use of com.hazelcast.simulator.utils.BashCommand in project hazelcast-simulator by hazelcast.

the class AgentUtils method stopAgents.

public static void stopAgents(SimulatorProperties properties, Registry registry) {
    String shutdownScript = getConfigurationFile("agent_shutdown.sh").getAbsolutePath();
    new BashCommand(shutdownScript).addParams(publicAddressesString(registry)).addEnvironment(properties.asMap()).execute();
}
Also used : BashCommand(com.hazelcast.simulator.utils.BashCommand) AgentData.publicAddressesString(com.hazelcast.simulator.coordinator.registry.AgentData.publicAddressesString)

Example 2 with BashCommand

use of com.hazelcast.simulator.utils.BashCommand in project hazelcast-simulator by hazelcast.

the class ProcessSuicideThread method run.

@Override
public void run() {
    if (parentPid == null || intervalSeconds == 0) {
        return;
    }
    try {
        for (; ; ) {
            SECONDS.sleep(intervalSeconds);
            BashCommand bashCommand = new BashCommand("ps -p " + parentPid);
            bashCommand.setThrowsException(true);
            try {
                bashCommand.execute();
            } catch (Exception e) {
                String msg = "Process terminating; parent process with pid [" + parentPid + "] is not alive";
                LOGGER.error(msg);
                System.err.println(msg);
                System.exit(1);
            }
        }
    } catch (InterruptedException e) {
        ignore(e);
    }
}
Also used : BashCommand(com.hazelcast.simulator.utils.BashCommand)

Example 3 with BashCommand

use of com.hazelcast.simulator.utils.BashCommand in project hazelcast-simulator by hazelcast.

the class AgentsSshCli method executeCommand.

private void executeCommand() {
    List commands = options.nonOptionArguments();
    if (commands.size() != 1) {
        throw new CommandLineExitException("1 argument expected");
    }
    String command = (String) commands.get(0);
    String sshOptions = properties.get("SSH_OPTIONS");
    String simulatorUser = properties.get("SIMULATOR_USER");
    for (AgentData agent : findAgents()) {
        System.out.println("[" + agent.getPublicAddress() + "]");
        new BashCommand("ssh -n -o LogLevel=quiet " + sshOptions + " " + simulatorUser + "@" + agent.getPublicAddress() + " '" + command + "'").setSystemOut(true).addEnvironment(properties.asMap()).execute();
    }
}
Also used : CommandLineExitException(com.hazelcast.simulator.utils.CommandLineExitException) BashCommand(com.hazelcast.simulator.utils.BashCommand) AgentData(com.hazelcast.simulator.coordinator.registry.AgentData) Collections.singletonList(java.util.Collections.singletonList) List(java.util.List) AgentData.publicAddressesString(com.hazelcast.simulator.coordinator.registry.AgentData.publicAddressesString)

Example 4 with BashCommand

use of com.hazelcast.simulator.utils.BashCommand in project hazelcast-simulator by hazelcast.

the class JetDriver method install.

@Override
public void install() {
    String cloud = get("CLOUD_PROVIDER");
    if ("embedded".equals(cloud)) {
        return;
    }
    String versionSpec = get("VERSION_SPEC");
    LOGGER.info("Installing versionSpec [" + versionSpec + "] on " + agents.size() + " agents...");
    String publicIps = "";
    if (!"local".equals(cloud)) {
        publicIps = AgentData.publicAddressesString(agents);
    }
    String vendor = get("VENDOR");
    String installFile = getConfigurationFile("install-" + vendor + ".sh").getPath();
    LOGGER.info("Installing '" + vendor + "' version '" + versionSpec + "' on Agents using " + installFile);
    new BashCommand(installFile).addParams(get("SESSION_ID"), versionSpec, publicIps).addEnvironment(properties).execute();
    LOGGER.info("Successfully installed '" + vendor + "'");
    LOGGER.info("Install successful!");
}
Also used : BashCommand(com.hazelcast.simulator.utils.BashCommand)

Example 5 with BashCommand

use of com.hazelcast.simulator.utils.BashCommand in project hazelcast-simulator by hazelcast.

the class TestCaseRunner method recordTimestamp.

private void recordTimestamp(String label) {
    String startScript = getConfigurationFile("record_timestamp.sh").getAbsolutePath();
    new BashCommand(startScript).addParams(publicAddressesString(registry), coordinatorParameters.getSessionId(), testCase.getId(), label).addEnvironment(coordinatorParameters.getSimulatorProperties().asMap()).execute();
}
Also used : BashCommand(com.hazelcast.simulator.utils.BashCommand) AgentData.publicAddressesString(com.hazelcast.simulator.coordinator.registry.AgentData.publicAddressesString)

Aggregations

BashCommand (com.hazelcast.simulator.utils.BashCommand)12 AgentData.publicAddressesString (com.hazelcast.simulator.coordinator.registry.AgentData.publicAddressesString)4 AgentData (com.hazelcast.simulator.coordinator.registry.AgentData)2 CommandLineExitException (com.hazelcast.simulator.utils.CommandLineExitException)2 UuidUtil.newUnsecureUuidString (com.hazelcast.simulator.utils.UuidUtil.newUnsecureUuidString)2 AgentsFile (com.hazelcast.simulator.common.AgentsFile)1 ProvisionerUtils.getInitScriptFile (com.hazelcast.simulator.provisioner.ProvisionerUtils.getInitScriptFile)1 FileUtils.getConfigurationFile (com.hazelcast.simulator.utils.FileUtils.getConfigurationFile)1 FileUtils.newFile (com.hazelcast.simulator.utils.FileUtils.newFile)1 File (java.io.File)1 Collections.singletonList (java.util.Collections.singletonList)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 Map (java.util.Map)1 Future (java.util.concurrent.Future)1