public ProcessExecutor(File workingDirectory, List<String> paths, List<String> command, Platform platform, Map<String, String> additionalEnvironment, long timeoutInSeconds) { this.environment = createEnvironment(paths, platform, additionalEnvironment); this.commandLine = createCommandLine(command); this.executor = createExecutor(workingDirectory, timeoutInSeconds); }
public String executeAndGetResult(final Logger logger) throws ProcessExecutionException { return executor.executeAndGetResult(logger); }
public int executeAndRedirectOutput(final Logger logger) throws ProcessExecutionException { return executor.executeAndRedirectOutput(logger); } }
public YarnExecutor(YarnExecutorConfig config, List<String> arguments, Map<String, String> additionalEnvironment) { final String yarn = config.getYarnPath().getAbsolutePath(); List<String> localPaths = new ArrayList<>(); localPaths.add(config.getYarnPath().getParent()); localPaths.add(config.getNodePath().getParent()); executor = new ProcessExecutor(config.getWorkingDirectory(), localPaths, Utils.prepend(yarn, arguments), config.getPlatform(), additionalEnvironment); }
public String executeAndGetResult(final Logger logger) throws ProcessExecutionException { ByteArrayOutputStream stdout = new ByteArrayOutputStream(); ByteArrayOutputStream stderr = new ByteArrayOutputStream(); int exitValue = execute(logger, stdout, stderr); if (exitValue == 0) { return stdout.toString().trim(); } else { throw new ProcessExecutionException(stdout + " " + stderr); } }
public NodeExecutor(NodeExecutorConfig config, List<String> arguments, Map<String, String> additionalEnvironment){ final String node = config.getNodePath().getAbsolutePath(); List<String> localPaths = new ArrayList<String>(); localPaths.add(config.getNodePath().getParent()); this.executor = new ProcessExecutor( config.getWorkingDirectory(), localPaths, Utils.prepend(node, arguments), config.getPlatform(), additionalEnvironment); }
public int executeAndRedirectOutput(final Logger logger) throws ProcessExecutionException { OutputStream stdout = new LoggerOutputStream(logger, 0); OutputStream stderr = new LoggerOutputStream(logger, 1); return execute(logger, stdout, stderr); }
public int executeAndRedirectOutput(final Logger logger) throws ProcessExecutionException { return executor.executeAndRedirectOutput(logger); } }
public String executeAndGetResult(final Logger logger) throws ProcessExecutionException { return executor.executeAndGetResult(logger); }