private void signalStartToAgent() { String address = getHazelcastAddress(type, publicAddress, hazelcastInstance); File file = new File(getUserDir(), "worker.address"); writeText(address, file); }
private void generateWorkerStartScript(WorkerProcess workerProcess) { File startScript = new File(workerProcess.getWorkerHome(), "worker.sh"); String script = workerProcessSettings.getWorkerScript(); writeText(script, startScript); }
static void copyResourceFile(File workDir, String targetName, String sourceName) { File runScript = ensureExistingFile(workDir, targetName); writeText(getResourceFile(sourceName), runScript); execute(format("chmod u+x %s", runScript.getAbsolutePath())); }
private void createPidFile() { deleteQuiet(pidFile); writeText("" + getPID(), pidFile); }
public static void save(File agentsFile, ComponentRegistry registry) { StringBuilder sb = new StringBuilder(); for (AgentData agent : registry.getAgents()) { String publicAddress = agent.getPublicAddress(); String privateAddress = agent.getPrivateAddress(); if (publicAddress.equals(privateAddress)) { sb.append(publicAddress); } else { sb.append(publicAddress).append(',').append(privateAddress); } Map<String, String> tags = agent.getTags(); if (!tags.isEmpty()) { sb.append('|').append(tagsToString(tags)); } sb.append(NEW_LINE); } writeText(sb.toString(), agentsFile); } }
writeText(testId + NEW_LINE + throwableToString(cause), tmpFile);
writeText(testId + NEW_LINE + throwableToString(cause), tmpFile);
public static void main(String[] args) { int pid = NativeUtils.getPID(); LOGGER.info("PID: " + pid); writeText("" + pid, new File(getUserDir(), "worker.pid")); try { startWorker(); } catch (Exception e) { ExceptionReporter.report(null, e); exitWithError(LOGGER, "Could not start Hazelcast Simulator Worker!", e); } }
void createSshCopyIdScript(SimulatorProperties simulatorProperties) { ComponentRegistry componentRegistry = loadComponentRegister(agentFile, true); String userName = simulatorProperties.getUser(); ensureExistingFile(SSH_COPY_ID_FILE); writeText("#!/bin/bash" + NEW_LINE + NEW_LINE, SSH_COPY_ID_FILE); for (AgentData agentData : componentRegistry.getAgents()) { String publicAddress = agentData.getPublicAddress(); appendText(format("ssh-copy-id -i ~/.ssh/id_rsa.pub %s@%s%n", userName, publicAddress), SSH_COPY_ID_FILE); } execute(format("chmod u+x %s", SSH_COPY_ID_FILE.getAbsoluteFile())); echo("Please execute './%s' to copy your public RSA key to all remote machines.", SSH_COPY_ID_FILE.getName()); }
writeText(javaCode, javaFile);
private void executeInitScript(String ip) { File initFile = newFile("init-" + newUnsecureUuidString() + ".sh"); writeText(loadInitScript(), initFile); bash.scpToRemote(ip, initFile, "init.sh"); bash.sshTTY(ip, "bash init.sh"); deleteQuiet(initFile); }
writeText(format("%s=%s%n", PROPERTY_CLOUD_PROVIDER, cloudProvider), simulatorPropertiesFile); if (isEC2(cloudProvider)) { appendText(format(