org.renci.common.exec.Executor类的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(13.9k)|赞(0)|评价(0)|浏览(223)

本文整理了Java中org.renci.common.exec.Executor类的一些代码示例,展示了Executor类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Executor类的具体详情如下:
包路径:org.renci.common.exec.Executor
类名称:Executor

Executor介绍

暂无

代码示例

代码示例来源:origin: edu.unc.mapseq/modules

@Override
public ModuleOutput call() throws Exception {
  logger.debug("ENTERING call()");
  Properties readLengthProperties = new Properties();
  FileInputStream fis = new FileInputStream(this.readLength);
  readLengthProperties.loadFromXML(fis);
  fis.close();
  StringBuilder command = new StringBuilder(getExecutable());
  command.append(" ").append(junction.getAbsolutePath());
  command.append(" ").append(readLengthProperties.getProperty("maxLength"));
  command.append(" ").append(minimumAnchor.toString());
  command.append(" ").append(referenceSequenceDirectory.getAbsolutePath());
  command.append(" ").append(sam.getAbsolutePath());
  CommandInput commandInput = new CommandInput();
  logger.info("command.toString(): {}", command.toString());
  commandInput.setCommand(command.toString());
  CommandOutput commandOutput;
  try {
    Executor executor = BashExecutor.getInstance();
    commandOutput = executor.execute(commandInput, new File(System.getProperty("user.home"), ".mapseqrc"));
  } catch (ExecutorException e) {
    throw new ModuleException(e);
  }
  return new ShellModuleOutput(commandOutput);
}

代码示例来源:origin: org.renci.launchers/launcher-core

public void run() {
  for (LaunchDescriptorBean ldb : getLaunchDescriptorBeans()) {
    String command = ldb.getCommands().get(0);
    logger.debug("command = " + command);
    Executor sh = new Executor(command);
    sh.setEnvironment(new HashMap<String, String>());
    sh.setWorkDir(getWorkDirectory());
    try {
      sh.execute();
    } catch (ExecutorException e) {
      logger.error("Execution error: " + e.getMessage());
    }
    setStdOut(sh.getStdout());
    setStdErr(sh.getStderr());
    setExitCode(sh.getExitCode());
  }
}

代码示例来源:origin: org.renci.condor/condor-cli

public void reschedule() throws CondorException {
    logger.debug("ENTERING reschedule()");
    try {
      Input input = new Input();
      input.setCommand(CONDOR_RESCHEDULE);
      Executor executor = Executor.getInstance();
      executor.run(input);
    } catch (ExecutorException e) {
      throw new CondorException("Problem running: " + CONDOR_RESCHEDULE);
    }
  }
}

代码示例来源:origin: org.renci.genesis2/genesis2-core

Velocity.evaluate(velocityContext, sw, "CheckStatusCallable.call", template);
  FileUtils.writeStringToFile(checkStatusFile, sw.toString());
  Executor chmodExecutor = new Executor("chmod 755 " + checkStatusFile.getAbsolutePath());
  chmodExecutor.execute();
} catch (ExecutorException e) {
  e.printStackTrace();
Executor checkStatusExecutor = new Executor(checkStatusFile.getAbsolutePath());
checkStatusExecutor.execute();
String stdout = checkStatusExecutor.getStdout();

代码示例来源:origin: org.renci.genesis2/genesis2-core

Velocity.evaluate(velocityContext, sw, "DownloadResultsRunnable.run", template);
  FileUtils.writeStringToFile(downloadResultsFile, sw.toString());
  Executor chmodExecutor = new Executor("chmod 755 " + downloadResultsFile.getAbsolutePath());
  chmodExecutor.execute();
} catch (ExecutorException e) {
  e.printStackTrace();
  Executor downloadResultsExecutor = new Executor(downloadResultsFile.getAbsolutePath());
  downloadResultsExecutor.execute();
} catch (ExecutorException e) {
  e.printStackTrace();

代码示例来源:origin: org.renci.genesis2/genesis2-core

Velocity.evaluate(velocityContext, sw, "SubmitCallable.call", template);
  FileUtils.writeStringToFile(submitFile, sw.toString());
  Executor chmodExecutor = new Executor("chmod 755 " + submitFile.getAbsolutePath());
  chmodExecutor.execute();
} catch (ExecutorException e) {
  e.printStackTrace();
  Executor submitExecutor = new Executor(submitFile.getAbsolutePath());
  submitExecutor.execute();
  String stdout = submitExecutor.getStdout();
  int startIdx = stdout.indexOf("\"") + 1;
  int endIdx = stdout.lastIndexOf("\"");

代码示例来源:origin: edu.unc.mapseq/modules

@Override
public ModuleOutput call() throws Exception {
  logger.debug("ENTERING call()");
  StringBuilder command = new StringBuilder(getExecutable());
  command.append(" ").append(this.minimumAnchor.toString());
  command.append(" ").append(this.maximumAnchor.toString());
  command.append(" ").append(this.maximumSequenceThreshold.toString());
  command.append(" ").append(this.junction.getAbsolutePath());
  command.append(" ").append(this.referenceSequenceDirectory.getAbsolutePath());
  if (this.referenceSequenceDirectory.isDirectory()
      && !this.referenceSequenceDirectory.getAbsolutePath().endsWith("/")) {
    command.append("/");
  }
  command.append(" ").append(this.output.getAbsolutePath());
  CommandInput commandInput = new CommandInput();
  logger.info("command.toString(): {}", command.toString());
  commandInput.setCommand(command.toString());
  CommandOutput commandOutput;
  try {
    Executor executor = BashExecutor.getInstance();
    commandOutput = executor.execute(commandInput, new File(System.getProperty("user.home"), ".mapseqrc"));
  } catch (ExecutorException e) {
    throw new ModuleException(e);
  }
  return new ShellModuleOutput(commandOutput);
}

代码示例来源:origin: org.renci.cm/rsp-cm-myproxy-cli

Executor sh = Executor.getInstance();
try {
  Input input = new Input();
  input.setCommand(command.toString());
  Output output = sh.run(input);
  if ((output.getStderr() != null && output.getStderr().length() > 2)
      || (output.getStdout() != null && output.getStdout().length() > 2)) {

代码示例来源:origin: edu.unc.mapseq/modules

@Override
public ModuleOutput call() throws Exception {
  logger.debug("ENTERING call()");
  StringBuilder command = new StringBuilder(getExecutable());
  command.append(" ").append(input.getAbsolutePath());
  command.append(" ").append(outputDirectory.getAbsolutePath());
  if (this.outputDirectory.isDirectory() && !this.outputDirectory.getAbsolutePath().endsWith("/")) {
    command.append("/");
  }
  CommandInput commandInput = new CommandInput();
  logger.info("command.toString(): {}", command.toString());
  commandInput.setCommand(command.toString());
  CommandOutput commandOutput;
  try {
    Executor executor = BashExecutor.getInstance();
    commandOutput = executor.execute(commandInput, new File(System.getProperty("user.home"), ".mapseqrc"));
  } catch (ExecutorException e) {
    throw new ModuleException(e);
  }
  return new ShellModuleOutput(commandOutput);
}

代码示例来源:origin: org.renci.cm/rsp-cm-myproxy-cli

command.append("; rm -f ").append(in.getPath());
Executor sh = Executor.getInstance();
try {
  Input input = new Input();
  input.setCommand(command.toString());
  Output output = sh.run(input);

代码示例来源:origin: edu.unc.mapseq/modules

@Override
public ModuleOutput call() throws Exception {
  logger.debug("ENTERING call()");
  StringBuilder command = new StringBuilder(getExecutable());
  command.append(" ").append(this.minimumAnchorWidth.toString());
  command.append(" ").append(this.maximumAnchor.toString());
  command.append(" ").append(this.maximumThresholdEach.toString());
  command.append(" ").append(this.maximumThresholdTotal.toString());
  command.append(" ").append(this.junction.getAbsolutePath());
  command.append(" 1");
  command.append(" ").append(this.fusionJunction.getAbsolutePath());
  command.append(" 1");
  command.append(" ").append(this.referenceSequenceDirectory.getAbsolutePath());
  if (this.referenceSequenceDirectory.isDirectory()
      && !this.referenceSequenceDirectory.getAbsolutePath().endsWith("/")) {
    command.append("/");
  }
  command.append(" ").append(this.output.getAbsolutePath());
  CommandInput commandInput = new CommandInput();
  logger.info("command.toString(): {}", command.toString());
  commandInput.setCommand(command.toString());
  CommandOutput commandOutput;
  try {
    Executor executor = BashExecutor.getInstance();
    commandOutput = executor.execute(commandInput, new File(System.getProperty("user.home"), ".mapseqrc"));
  } catch (ExecutorException e) {
    throw new ModuleException(e);
  }
  return new ShellModuleOutput(commandOutput);
}

代码示例来源:origin: org.renci.cm/rsp-cm-myproxy-cli

command.append(" rm -f ").append(in.getPath());
Executor sh = Executor.getInstance();
try {
  Input input = new Input();
  input.setCommand(command.toString());
  Output output = sh.run(input);
  if ((output.getStderr() != null && output.getStderr().length() > 2)
      || (output.getStdout() != null && output.getStdout().length() > 2)) {

代码示例来源:origin: edu.unc.mapseq/modules

@Override
public ModuleOutput call() throws ModuleException {
  CommandInput commandInput = new CommandInput();
  StringBuilder command = new StringBuilder();
  command.append(getModuleClass().getAnnotation(Executable.class).value());
  command.append(" ").append(inFile.getAbsolutePath());
  command.append(" ").append(outFile.getAbsolutePath());
  command.append(" ").append(transcriptDB.getAbsolutePath());
  command.append(" ").append(sqHeader.getAbsolutePath());
  commandInput.setCommand(command.toString());
  CommandOutput commandOutput;
  try {
    Executor executor = BashExecutor.getInstance();
    commandOutput = executor.execute(commandInput, new File(System.getProperty("user.home"), ".mapseqrc"));
  } catch (ExecutorException e) {
    throw new ModuleException(e);
  }
  return new ShellModuleOutput(commandOutput);
}

代码示例来源:origin: org.renci.condor/condor-cli

Executor executor = Executor.getInstance();
Output output = executor.run(input);
String stdout = output.getStdout().toString();
logger.debug("stdout = " + stdout);

代码示例来源:origin: edu.unc.mapseq/modules

@Override
public ModuleOutput call() throws Exception {
  logger.debug("ENTERING call()");
  StringBuilder command = new StringBuilder(getExecutable());
  command.append(" ").append(junctionFile.getAbsolutePath());
  Properties readLengthProperties = new Properties();
  FileInputStream fis = new FileInputStream(readLength);
  readLengthProperties.loadFromXML(fis);
  fis.close();
  command.append(" ").append(readLengthProperties.getProperty("maxLength"));
  command.append(" ").append(chromosomeFilesDirectory.getAbsolutePath());
  command.append(" ").append(minimumIntron);
  command.append(" ").append(maximumIntron);
  command.append(" ").append(minimumAnchor);
  for (File f : input) {
    command.append(" ").append(f.getAbsolutePath());
  }
  CommandInput commandInput = new CommandInput();
  logger.info("command.toString(): {}", command.toString());
  commandInput.setCommand(command.toString());
  CommandOutput commandOutput;
  try {
    Executor executor = BashExecutor.getInstance();
    commandOutput = executor.execute(commandInput, new File(System.getProperty("user.home"), ".mapseqrc"));
  } catch (ExecutorException e) {
    throw new ModuleException(e);
  }
  return new ShellModuleOutput(commandOutput);
}

代码示例来源:origin: org.renci.condor/condor-cli

input.setWorkDir(jobBean.getSubmitFile().getParentFile());
Executor executor = Executor.getInstance();
Output output = executor.run(input);
int exitCode = output.getExitCode();
LineNumberReader lnr = new LineNumberReader(new StringReader(output.getStdout().toString()));

代码示例来源:origin: edu.unc.mapseq/modules

@Override
public ModuleOutput call() throws Exception {
  CommandInput commandInput = new CommandInput();
  StringBuilder command = new StringBuilder();
  command.append(getModuleClass().getAnnotation(Executable.class).value());
  command.append(" -c ").append(column.toString());
  command.append(" -q ").append(quantile.toString());
  command.append(" -t ").append(target.toString());
  command.append(" -o ").append(output.getAbsolutePath());
  command.append(" ").append(input.getAbsolutePath());
  commandInput.setCommand(command.toString());
  CommandOutput commandOutput;
  try {
    Executor executor = BashExecutor.getInstance();
    commandOutput = executor.execute(commandInput, new File(System.getProperty("user.home"), ".mapseqrc"));
  } catch (ExecutorException e) {
    throw new ModuleException(e);
  }
  return new ShellModuleOutput(commandOutput);
}

代码示例来源:origin: edu.unc.mapseq/modules

@Override
public ModuleOutput call() throws Exception {
  logger.debug("ENTERING call()");
  StringBuilder command = new StringBuilder(getExecutable());
  command.append(" ").append(clusterDirectory.getAbsolutePath()).append("/");
  CommandInput commandInput = new CommandInput();
  logger.info("command.toString(): {}", command.toString());
  commandInput.setCommand(command.toString());
  CommandOutput commandOutput;
  try {
    Executor executor = BashExecutor.getInstance();
    commandOutput = executor.execute(commandInput, new File(System.getProperty("user.home"), ".mapseqrc"));
  } catch (ExecutorException e) {
    throw new ModuleException(e);
  }
  return new ShellModuleOutput(commandOutput);
}

代码示例来源:origin: edu.unc.mapseq/modules

@Override
public ModuleOutput call() throws Exception {
  logger.debug("ENTERING call()");
  StringBuilder command = new StringBuilder(getExecutable());
  command.append(" ").append(output.getAbsolutePath());
  if (fastq) {
    command.append(" 1");
  }
  command.append(" ").append(input.getAbsolutePath());
  CommandInput commandInput = new CommandInput();
  logger.info("command.toString(): {}", command.toString());
  commandInput.setCommand(command.toString());
  CommandOutput commandOutput;
  try {
    Executor executor = BashExecutor.getInstance();
    commandOutput = executor.execute(commandInput, new File(System.getProperty("user.home"), ".mapseqrc"));
  } catch (ExecutorException e) {
    throw new ModuleException(e);
  }
  return new ShellModuleOutput(commandOutput);
}

代码示例来源:origin: edu.unc.mapseq/modules

@Override
public ModuleOutput call() throws Exception {
  CommandInput commandInput = new CommandInput();
  StringBuilder commandSB = new StringBuilder();
  commandSB.append(this.executable);
  if (argument != null) {
    for (String arg : argument) {
      commandSB.append(String.format(" %s", arg));
    }
  }
  commandInput.setCommand(commandSB.toString());
  CommandOutput commandOutput;
  try {
    Executor executor = BashExecutor.getInstance();
    commandOutput = executor.execute(commandInput, new File(System.getProperty("user.home"), ".mapseqrc"));
  } catch (ExecutorException e) {
    throw new ModuleException(e);
  }
  return new ShellModuleOutput(commandOutput);
}

相关文章