public void uploadToRemoteSimulatorDir(String ip, String src, String target) { String command = format("rsync --checksum -avv -L -e \"ssh %s\" %s %s@%s:hazelcast-simulator-%s/%s", scpOptions, src, user, ip, getSimulatorVersion(), target); execute(command); }
@Override public void run() { String workersPath = format("hazelcast-simulator-%s/workers/%s", getSimulatorVersion(), sessionId); String targetDirectory = "*".equals(sessionId) ? outputDirectory.getAbsolutePath() : outputDirectory.getParentFile().getAbsolutePath(); String rsyncCommand = format(RSYNC_COMMAND, "", sshOptions, sshUser, targetDirectory); LOGGER.info(format("Downloading Worker logs from %s", ip)); bash.executeQuiet(format(rsyncCommand, ip, workersPath)); } }
private String loadInitScript() { String initScript = fileAsText(initScriptFile); initScript = initScript.replaceAll(Pattern.quote("${version}"), getSimulatorVersion()); initScript = initScript.replaceAll(Pattern.quote("${user}"), properties.getUser()); initScript = initScript.replaceAll(Pattern.quote("${cloudprovider}"), properties.getCloudProvider()); return initScript; }
private static void logHeader() { LOGGER.info("Hazelcast Simulator Agent"); LOGGER.info(format("Version: %s, Commit: %s, Build Time: %s", getSimulatorVersion(), getCommitIdAbbrev(), getBuildTime())); LOGGER.info(format("SIMULATOR_HOME: %s%n", getSimulatorHome().getAbsolutePath())); logImportantSystemProperties(); }
public static void main(String[] args) { LOGGER.info("Hazelcast Simulator Coordinator"); LOGGER.info(format("Version: %s, Commit: %s, Build Time: %s", getSimulatorVersion(), getCommitIdAbbrev(), getBuildTime())); LOGGER.info(format("SIMULATOR_HOME: %s", getSimulatorHome().getAbsolutePath())); try { CoordinatorCli cli = new CoordinatorCli(args); cli.run(); } catch (Exception e) { exitWithError(LOGGER, "Failed to run Coordinator", e); } } }
public static void main(String[] args) { LOGGER.info("Hazelcast Simulator Provisioner"); LOGGER.info(format("Version: %s, Commit: %s, Build Time: %s", getSimulatorVersion(), getCommitIdAbbrev(), getBuildTime())); LOGGER.info(format("SIMULATOR_HOME: %s", getSimulatorHome())); try { ProvisionerCli cli = new ProvisionerCli(args); cli.run(); } catch (Exception e) { exitWithError(LOGGER, "Could not execute command", e); } } }
public static void main(String[] args) { LOGGER.info("Hazelcast Simulator Wizard"); LOGGER.info(format("Version: %s, Commit: %s, Build Time: %s", getSimulatorVersion(), getCommitIdAbbrev(), getBuildTime())); try { WizardCli cli = new WizardCli(args); cli.run(); } catch (Exception e) { exitWithError(LOGGER, "Could not execute command", e); } } }
private void cleanRemote() { long started = System.nanoTime(); LOGGER.info(format("Cleaning Worker homes of %s machines...", componentRegistry.agentCount())); final String cleanCommand = format("rm -fr hazelcast-simulator-%s/workers/*", getSimulatorVersion()); ThreadSpawner spawner = new ThreadSpawner("clean", true); for (final AgentData agentData : componentRegistry.getAgents()) { spawner.spawn(new Runnable() { @Override public void run() { LOGGER.info(format("Cleaning %s", agentData.getPublicAddress())); bash.ssh(agentData.getPublicAddress(), cleanCommand); } }); } spawner.awaitCompletion(); long elapsed = getElapsedSeconds(started); LOGGER.info(format("Finished cleaning Worker homes of %s machines (%s seconds)", componentRegistry.agentCount(), elapsed)); } }
public static String getStartHarakiriMonitorCommandOrNull(SimulatorProperties properties) { if (!isHarakiriMonitorEnabled(properties)) { if (isEC2(properties)) { LOGGER.info("HarakiriMonitor is not enabled"); } return null; } String waitSeconds = properties.get("HARAKIRI_MONITOR_WAIT_SECONDS"); LOGGER.info(format("HarakiriMonitor is enabled and will kill inactive EC2 instances after %s seconds", waitSeconds)); return format( "nohup hazelcast-simulator-%s/bin/harakiri-monitor --cloudProvider %s --cloudIdentity %s --cloudCredential %s" + " --waitSeconds %s > harakiri.out 2> harakiri.err < /dev/null &", getSimulatorVersion(), properties.getCloudProvider(), properties.getCloudIdentity(), properties.getCloudCredential(), waitSeconds); } }
static void logHeader() { echo("Hazelcast Simulator AWS Provisioner"); echo("Version: %s, Commit: %s, Build Time: %s", getSimulatorVersion(), getCommitIdAbbrev(), getBuildTime()); echo("SIMULATOR_HOME: %s", getSimulatorHome().getAbsolutePath()); }
static void logHeader() { echo("Hazelcast Simulator HeatMap"); echo("Version: %s, Commit: %s, Build Time: %s", getSimulatorVersion(), getCommitIdAbbrev(), getBuildTime()); echo("SIMULATOR_HOME: %s", getSimulatorHome().getAbsolutePath()); }
static MemberWorker startWorker() throws Exception { echo("Hazelcast Simulator Worker"); echo("Version: %s, Commit: %s, Build Time: %s", getSimulatorVersion(), getCommitIdAbbrev(), getBuildTime()); echo("SIMULATOR_HOME: %s%n", getSimulatorHome().getAbsolutePath());
private void uploadJARs(String ip) { String simulatorVersion = getSimulatorVersion(); bash.ssh(ip, format("mkdir -p hazelcast-simulator-%s/lib/", simulatorVersion)); bash.ssh(ip, format("mkdir -p hazelcast-simulator-%s/user-lib/", simulatorVersion));