org.renci.common.exec.Executor.execute()方法的使用及代码示例

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

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

Executor.execute介绍

[英]run the command
[中]运行命令

代码示例

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

  1. @Override
  2. public ModuleOutput call() throws Exception {
  3. logger.debug("ENTERING call()");
  4. Properties readLengthProperties = new Properties();
  5. FileInputStream fis = new FileInputStream(this.readLength);
  6. readLengthProperties.loadFromXML(fis);
  7. fis.close();
  8. StringBuilder command = new StringBuilder(getExecutable());
  9. command.append(" ").append(junction.getAbsolutePath());
  10. command.append(" ").append(readLengthProperties.getProperty("maxLength"));
  11. command.append(" ").append(minimumAnchor.toString());
  12. command.append(" ").append(referenceSequenceDirectory.getAbsolutePath());
  13. command.append(" ").append(sam.getAbsolutePath());
  14. CommandInput commandInput = new CommandInput();
  15. logger.info("command.toString(): {}", command.toString());
  16. commandInput.setCommand(command.toString());
  17. CommandOutput commandOutput;
  18. try {
  19. Executor executor = BashExecutor.getInstance();
  20. commandOutput = executor.execute(commandInput, new File(System.getProperty("user.home"), ".mapseqrc"));
  21. } catch (ExecutorException e) {
  22. throw new ModuleException(e);
  23. }
  24. return new ShellModuleOutput(commandOutput);
  25. }

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

  1. @Override
  2. public ModuleOutput call() throws Exception {
  3. logger.debug("ENTERING call()");
  4. StringBuilder command = new StringBuilder(getExecutable());
  5. command.append(" ").append(input.getAbsolutePath());
  6. command.append(" ").append(outputDirectory.getAbsolutePath());
  7. if (this.outputDirectory.isDirectory() && !this.outputDirectory.getAbsolutePath().endsWith("/")) {
  8. command.append("/");
  9. }
  10. CommandInput commandInput = new CommandInput();
  11. logger.info("command.toString(): {}", command.toString());
  12. commandInput.setCommand(command.toString());
  13. CommandOutput commandOutput;
  14. try {
  15. Executor executor = BashExecutor.getInstance();
  16. commandOutput = executor.execute(commandInput, new File(System.getProperty("user.home"), ".mapseqrc"));
  17. } catch (ExecutorException e) {
  18. throw new ModuleException(e);
  19. }
  20. return new ShellModuleOutput(commandOutput);
  21. }

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

  1. @Override
  2. public ModuleOutput call() throws ModuleException {
  3. CommandInput commandInput = new CommandInput();
  4. StringBuilder command = new StringBuilder();
  5. command.append(getModuleClass().getAnnotation(Executable.class).value());
  6. command.append(" ").append(inFile.getAbsolutePath());
  7. command.append(" ").append(outFile.getAbsolutePath());
  8. command.append(" ").append(transcriptDB.getAbsolutePath());
  9. command.append(" ").append(sqHeader.getAbsolutePath());
  10. commandInput.setCommand(command.toString());
  11. CommandOutput commandOutput;
  12. try {
  13. Executor executor = BashExecutor.getInstance();
  14. commandOutput = executor.execute(commandInput, new File(System.getProperty("user.home"), ".mapseqrc"));
  15. } catch (ExecutorException e) {
  16. throw new ModuleException(e);
  17. }
  18. return new ShellModuleOutput(commandOutput);
  19. }

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

  1. @Override
  2. public ModuleOutput call() throws Exception {
  3. logger.debug("ENTERING call()");
  4. StringBuilder command = new StringBuilder(getExecutable());
  5. command.append(" ").append(this.minimumAnchorWidth.toString());
  6. command.append(" ").append(this.maximumAnchor.toString());
  7. command.append(" ").append(this.maximumThresholdEach.toString());
  8. command.append(" ").append(this.maximumThresholdTotal.toString());
  9. command.append(" ").append(this.junction.getAbsolutePath());
  10. command.append(" 1");
  11. command.append(" ").append(this.fusionJunction.getAbsolutePath());
  12. command.append(" 1");
  13. command.append(" ").append(this.referenceSequenceDirectory.getAbsolutePath());
  14. if (this.referenceSequenceDirectory.isDirectory()
  15. && !this.referenceSequenceDirectory.getAbsolutePath().endsWith("/")) {
  16. command.append("/");
  17. }
  18. command.append(" ").append(this.output.getAbsolutePath());
  19. CommandInput commandInput = new CommandInput();
  20. logger.info("command.toString(): {}", command.toString());
  21. commandInput.setCommand(command.toString());
  22. CommandOutput commandOutput;
  23. try {
  24. Executor executor = BashExecutor.getInstance();
  25. commandOutput = executor.execute(commandInput, new File(System.getProperty("user.home"), ".mapseqrc"));
  26. } catch (ExecutorException e) {
  27. throw new ModuleException(e);
  28. }
  29. return new ShellModuleOutput(commandOutput);
  30. }

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

  1. @Override
  2. public ModuleOutput call() throws Exception {
  3. logger.debug("ENTERING call()");
  4. StringBuilder command = new StringBuilder(getExecutable());
  5. command.append(" ").append(this.minimumAnchor.toString());
  6. command.append(" ").append(this.maximumAnchor.toString());
  7. command.append(" ").append(this.maximumSequenceThreshold.toString());
  8. command.append(" ").append(this.junction.getAbsolutePath());
  9. command.append(" ").append(this.referenceSequenceDirectory.getAbsolutePath());
  10. if (this.referenceSequenceDirectory.isDirectory()
  11. && !this.referenceSequenceDirectory.getAbsolutePath().endsWith("/")) {
  12. command.append("/");
  13. }
  14. command.append(" ").append(this.output.getAbsolutePath());
  15. CommandInput commandInput = new CommandInput();
  16. logger.info("command.toString(): {}", command.toString());
  17. commandInput.setCommand(command.toString());
  18. CommandOutput commandOutput;
  19. try {
  20. Executor executor = BashExecutor.getInstance();
  21. commandOutput = executor.execute(commandInput, new File(System.getProperty("user.home"), ".mapseqrc"));
  22. } catch (ExecutorException e) {
  23. throw new ModuleException(e);
  24. }
  25. return new ShellModuleOutput(commandOutput);
  26. }

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

  1. @Override
  2. public ModuleOutput call() throws Exception {
  3. CommandInput commandInput = new CommandInput();
  4. StringBuilder command = new StringBuilder();
  5. command.append(getModuleClass().getAnnotation(Executable.class).value());
  6. command.append(" -c ").append(column.toString());
  7. command.append(" -q ").append(quantile.toString());
  8. command.append(" -t ").append(target.toString());
  9. command.append(" -o ").append(output.getAbsolutePath());
  10. command.append(" ").append(input.getAbsolutePath());
  11. commandInput.setCommand(command.toString());
  12. CommandOutput commandOutput;
  13. try {
  14. Executor executor = BashExecutor.getInstance();
  15. commandOutput = executor.execute(commandInput, new File(System.getProperty("user.home"), ".mapseqrc"));
  16. } catch (ExecutorException e) {
  17. throw new ModuleException(e);
  18. }
  19. return new ShellModuleOutput(commandOutput);
  20. }

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

  1. @Override
  2. public ModuleOutput call() throws Exception {
  3. logger.debug("ENTERING call()");
  4. StringBuilder command = new StringBuilder(getExecutable());
  5. command.append(" ").append(clusterDirectory.getAbsolutePath()).append("/");
  6. CommandInput commandInput = new CommandInput();
  7. logger.info("command.toString(): {}", command.toString());
  8. commandInput.setCommand(command.toString());
  9. CommandOutput commandOutput;
  10. try {
  11. Executor executor = BashExecutor.getInstance();
  12. commandOutput = executor.execute(commandInput, new File(System.getProperty("user.home"), ".mapseqrc"));
  13. } catch (ExecutorException e) {
  14. throw new ModuleException(e);
  15. }
  16. return new ShellModuleOutput(commandOutput);
  17. }

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

  1. @Override
  2. public ModuleOutput call() throws Exception {
  3. CommandInput commandInput = new CommandInput();
  4. StringBuilder commandSB = new StringBuilder();
  5. commandSB.append(this.executable);
  6. if (argument != null) {
  7. for (String arg : argument) {
  8. commandSB.append(String.format(" %s", arg));
  9. }
  10. }
  11. commandInput.setCommand(commandSB.toString());
  12. CommandOutput commandOutput;
  13. try {
  14. Executor executor = BashExecutor.getInstance();
  15. commandOutput = executor.execute(commandInput, new File(System.getProperty("user.home"), ".mapseqrc"));
  16. } catch (ExecutorException e) {
  17. throw new ModuleException(e);
  18. }
  19. return new ShellModuleOutput(commandOutput);
  20. }

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

  1. @Override
  2. public ModuleOutput call() throws Exception {
  3. logger.debug("ENTERING call()");
  4. StringBuilder command = new StringBuilder(getExecutable());
  5. command.append(" ").append(output.getAbsolutePath());
  6. if (fastq) {
  7. command.append(" 1");
  8. }
  9. command.append(" ").append(input.getAbsolutePath());
  10. CommandInput commandInput = new CommandInput();
  11. logger.info("command.toString(): {}", command.toString());
  12. commandInput.setCommand(command.toString());
  13. CommandOutput commandOutput;
  14. try {
  15. Executor executor = BashExecutor.getInstance();
  16. commandOutput = executor.execute(commandInput, new File(System.getProperty("user.home"), ".mapseqrc"));
  17. } catch (ExecutorException e) {
  18. throw new ModuleException(e);
  19. }
  20. return new ShellModuleOutput(commandOutput);
  21. }

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

  1. @Override
  2. public ModuleOutput call() throws ModuleException {
  3. File userHome = new File(System.getProperty("user.home"));
  4. CommandInput commandInput = new CommandInput();
  5. StringBuilder command = new StringBuilder();
  6. command.append(String.format(getModuleClass().getAnnotation(Executable.class).value()));
  7. commandInput.setCommand(command.toString());
  8. CommandOutput commandOutput;
  9. try {
  10. Executor executor = BashExecutor.getInstance();
  11. commandOutput = executor.execute(commandInput, new File(userHome, ".mapseqrc"));
  12. } catch (ExecutorException e) {
  13. throw new ModuleException(e);
  14. }
  15. return new ShellModuleOutput(commandOutput);
  16. }

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

  1. @Override
  2. public ModuleOutput call() throws ModuleException {
  3. CommandOutput commandOutput = null;
  4. try {
  5. StringBuilder command = new StringBuilder();
  6. command.append("/bin/ln -s ").append(fastaDB).append(" ").append(symlinkFile.getAbsolutePath()).append(";");
  7. command.append(String.format("$%s_%s", getWorkflowName().toUpperCase(),
  8. getModuleClass().getAnnotation(Executable.class).value()));
  9. command.append(" ")
  10. .append(getModuleClass().getDeclaredField("algorithm").getAnnotation(InputArgument.class).flag())
  11. .append(" ").append(algorithm.getValue());
  12. command.append(" ").append(symlinkFile.getAbsolutePath());
  13. CommandInput commandInput = new CommandInput();
  14. File mapseqTmpDir = new File(System.getenv("MAPSEQ_HOME"), "tmp");
  15. commandInput.setWorkDir(mapseqTmpDir);
  16. commandInput.setCommand(command.toString());
  17. Executor executor = BashExecutor.getInstance();
  18. commandOutput = executor.execute(commandInput, new File(System.getProperty("user.home"), ".mapseqrc"));
  19. } catch (Exception e) {
  20. throw new ModuleException(e);
  21. }
  22. return new ShellModuleOutput(commandOutput);
  23. }

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

  1. @Override
  2. public ModuleOutput call() throws ModuleException {
  3. CommandInput commandInput = new CommandInput();
  4. commandInput.setCommand(String.format(getModuleClass().getAnnotation(Executable.class).value(),
  5. getWorkflowName().toUpperCase(), input.getAbsolutePath(), output.getAbsolutePath()));
  6. CommandOutput commandOutput;
  7. try {
  8. Executor executor = BashExecutor.getInstance();
  9. commandOutput = executor.execute(commandInput, new File(System.getProperty("user.home"), ".mapseqrc"));
  10. } catch (ExecutorException e) {
  11. throw new ModuleException(e);
  12. }
  13. return new ShellModuleOutput(commandOutput);
  14. }

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

  1. @Override
  2. public ModuleOutput call() throws Exception {
  3. CommandInput commandInput = new CommandInput();
  4. commandInput.setCommand(String.format(getModuleClass().getAnnotation(Executable.class).value(),
  5. geneResults.getAbsolutePath(), origGeneResults.getAbsolutePath()));
  6. CommandOutput commandOutput;
  7. try {
  8. Executor executor = BashExecutor.getInstance();
  9. commandOutput = executor.execute(commandInput, new File(System.getProperty("user.home"), ".mapseqrc"));
  10. } catch (ExecutorException e) {
  11. throw new ModuleException(e);
  12. }
  13. return new ShellModuleOutput(commandOutput);
  14. }

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

  1. @Override
  2. public ModuleOutput call() throws ModuleException {
  3. CommandInput commandInput = new CommandInput();
  4. commandInput.setCommand(String.format(getModuleClass().getAnnotation(Executable.class).value(),
  5. getWorkflowName().toUpperCase(), input.getAbsolutePath(), output.getAbsolutePath()));
  6. CommandOutput commandOutput;
  7. try {
  8. Executor executor = BashExecutor.getInstance();
  9. commandOutput = executor.execute(commandInput, new File(System.getProperty("user.home"), ".mapseqrc"));
  10. } catch (ExecutorException e) {
  11. throw new ModuleException(e);
  12. }
  13. return new ShellModuleOutput(commandOutput);
  14. }

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

  1. @Override
  2. public ModuleOutput call() throws ModuleException {
  3. CommandInput commandInput = new CommandInput();
  4. StringBuilder command = new StringBuilder();
  5. command.append(getModuleClass().getAnnotation(Executable.class).value());
  6. try {
  7. command.append(output.getAbsolutePath());
  8. for (File f : entry) {
  9. command.append(" ").append(f.getAbsolutePath());
  10. }
  11. } catch (Exception e) {
  12. throw new ModuleException(e);
  13. }
  14. commandInput.setCommand(command.toString());
  15. CommandOutput commandOutput;
  16. try {
  17. Executor executor = BashExecutor.getInstance();
  18. commandOutput = executor.execute(commandInput, new File(System.getProperty("user.home"), ".mapseqrc"));
  19. } catch (ExecutorException e) {
  20. throw new ModuleException(e);
  21. }
  22. return new ShellModuleOutput(commandOutput);
  23. }

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

  1. @Override
  2. public ModuleOutput call() throws Exception {
  3. CommandInput commandInput = new CommandInput();
  4. StringBuilder command = new StringBuilder();
  5. command.append(getModuleClass().getAnnotation(Executable.class).value());
  6. command.append(" ").append(input.getAbsolutePath()).append(" ").append(output.getAbsolutePath());
  7. commandInput.setCommand(command.toString());
  8. CommandOutput commandOutput;
  9. try {
  10. Executor executor = BashExecutor.getInstance();
  11. commandOutput = executor.execute(commandInput, new File(System.getProperty("user.home"), ".mapseqrc"));
  12. } catch (ExecutorException e) {
  13. throw new ModuleException(e);
  14. }
  15. FileData fileData = new FileData();
  16. fileData.setMimeType(MimeType.APPLICATION_PDF);
  17. fileData.setName(output.getName());
  18. addFileData(fileData);
  19. return new ShellModuleOutput(commandOutput);
  20. }

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

  1. @Override
  2. public ModuleOutput call() throws ModuleException {
  3. CommandInput commandInput = new CommandInput();
  4. commandInput.setCommand(String.format(getModuleClass().getAnnotation(Executable.class).value(),
  5. flagstatInput.getAbsolutePath(), output.getAbsolutePath()));
  6. CommandOutput commandOutput;
  7. try {
  8. Executor executor = BashExecutor.getInstance();
  9. commandOutput = executor.execute(commandInput);
  10. } catch (ExecutorException e) {
  11. throw new ModuleException(e);
  12. }
  13. return new ShellModuleOutput(commandOutput);
  14. }

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

  1. @Override
  2. public ModuleOutput call() throws ModuleException {
  3. CommandInput commandInput = new CommandInput();
  4. commandInput.setCommand(String.format(getModuleClass().getAnnotation(Executable.class).value(),
  5. flagstatInput.getAbsolutePath(), output.getAbsolutePath()));
  6. CommandOutput commandOutput;
  7. try {
  8. Executor executor = BashExecutor.getInstance();
  9. commandOutput = executor.execute(commandInput);
  10. } catch (ExecutorException e) {
  11. throw new ModuleException(e);
  12. }
  13. return new ShellModuleOutput(commandOutput);
  14. }

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

  1. @Override
  2. public ModuleOutput call() throws ModuleException {
  3. logger.debug("ENTERING call()");
  4. CommandOutput commandOutput;
  5. try {
  6. StringBuilder command = new StringBuilder();
  7. command.append(getModuleClass().getAnnotation(Executable.class).value());
  8. command.append(" ").append(regularExpression);
  9. command.append(" > ").append(outputFile.getAbsolutePath());
  10. CommandInput commandInput = new CommandInput();
  11. commandInput.setWorkDir(directory);
  12. commandInput.setCommand(command.toString());
  13. Executor executor = BashExecutor.getInstance();
  14. commandOutput = executor.execute(commandInput, new File(System.getProperty("user.home"), ".mapseqrc"));
  15. if (mimeType != null) {
  16. FileData fileData = new FileData();
  17. fileData.setName(outputFile.getName());
  18. fileData.setMimeType(mimeType);
  19. addFileData(fileData);
  20. }
  21. } catch (ExecutorException e) {
  22. throw new ModuleException(e);
  23. }
  24. return new ShellModuleOutput(commandOutput);
  25. }

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

  1. public void run() {
  2. for (LaunchDescriptorBean ldb : getLaunchDescriptorBeans()) {
  3. String command = ldb.getCommands().get(0);
  4. logger.debug("command = " + command);
  5. Executor sh = new Executor(command);
  6. sh.setEnvironment(new HashMap<String, String>());
  7. sh.setWorkDir(getWorkDirectory());
  8. try {
  9. sh.execute();
  10. } catch (ExecutorException e) {
  11. logger.error("Execution error: " + e.getMessage());
  12. }
  13. setStdOut(sh.getStdout());
  14. setStdErr(sh.getStderr());
  15. setExitCode(sh.getExitCode());
  16. }
  17. }

相关文章