private void download(AgentData agentData) { String ip = agentData.getPublicAddress(); String agentAddress = agentData.getAddress().toString(); LOGGER.info(format("Downloading Agent logs from %s", ip)); String outputPath = outputDirectory.getAbsolutePath(); String rsyncCommand = format(RSYNC_COMMAND, "--backup --suffix=-%s ", sshOptions, sshUser, outputPath); bash.executeQuiet(format(rsyncCommand, ip, ip, "agent.out")); bash.executeQuiet(format(rsyncCommand, ip, ip, "agent.err")); File agentOut = new File(outputPath, "agent.out"); File agentErr = new File(outputPath, "agent.err"); rename(agentOut, new File(outputPath, agentAddress + '-' + ip + "-agent.out")); rename(agentErr, new File(outputPath, agentAddress + '-' + ip + "-agent.err")); } }
rename(tmpFile, file);
rename(tmpFile, file);
private void detectExceptions(WorkerProcess workerProcess) { File workerHome = workerProcess.getWorkerHome(); if (!workerHome.exists()) { return; } File[] exceptionFiles = ExceptionExtensionFilter.listFiles(workerHome); for (File exceptionFile : exceptionFiles) { String content = fileAsText(exceptionFile); int indexOf = content.indexOf(NEW_LINE); String testId = content.substring(0, indexOf); String cause = content.substring(indexOf + 1); if (testId.isEmpty() || "null".equals(testId)) { testId = null; } // we delete or rename the exception file so that we don't detect the same exception again boolean send = failureHandler.handle("Worked ran into an unhandled exception", WORKER_EXCEPTION, workerProcess, testId, cause); if (send) { deleteQuiet(exceptionFile); } else { rename(exceptionFile, new File(exceptionFile.getParentFile(), exceptionFile.getName() + ".sendFailure")); } } }