PBS qsub command.
<p>
Equivalent to qsub [param]

@param input job input file
@return job id
165025
public static String qsub(String input) {
        final CommandLine cmdLine = new CommandLine(COMMAND_QSUB);
        cmdLine.addArgument(input);

        final OutputStream out = new ByteArrayOutputStream();
        final OutputStream err = new ByteArrayOutputStream();

        DefaultExecuteResultHandler resultHandler;
        try {
            resultHandler = execute(cmdLine, null, out, err);
            resultHandler.waitFor(DEFAULT_TIMEOUT);
        } catch (ExecuteException e) {
            throw new PBSException("Failed to execute qsub command: " + e.getMessage(), e);
        } catch (IOException e) {
            throw new PBSException("Failed to execute qsub command: " + e.getMessage(), e);
        } catch (InterruptedException e) {
            throw new PBSException("Failed to execute qsub command: " + e.getMessage(), e);
        }

        final int exitValue = resultHandler.getExitValue();
        LOGGER.info("qsub exit value: " + exitValue);
        LOGGER.fine("qsub output: " + out.toString());

        if (exitValue != 0)
            throw new PBSException("Failed to submit job script " + input + ". Error output: " + err.toString());

        String jobId = out.toString();
        return jobId.trim();
    }
1218184
public static CommandOutput traceJob(String jobId, int numberOfDays, boolean quiet) {
        final CommandLine cmdLine = new CommandLine(COMMAND_TRACEJOB);
        cmdLine.addArgument(PARAMETER_NUMBER_OF_DAYS);
        cmdLine.addArgument(Integer.toString(numberOfDays));
        if (quiet) {
            cmdLine.addArgument(PARAMETER_QUIET_MODE);
        }
        cmdLine.addArgument(jobId);

        final OutputStream out = new ByteArrayOutputStream();
        final OutputStream err = new ByteArrayOutputStream();

        DefaultExecuteResultHandler resultHandler;
        try {
            resultHandler = execute(cmdLine, null, out, err);
            resultHandler.waitFor(DEFAULT_TIMEOUT);
        } catch (ExecuteException e) {
            throw new PBSException("Failed to execute tracejob command: " + e.getMessage(), e);
        } catch (IOException e) {
            throw new PBSException("Failed to execute tracejob command: " + e.getMessage(), e);
        } catch (InterruptedException e) {
            throw new PBSException("Failed to execute tracejob command: " + e.getMessage(), e);
        }

        final int exitValue = resultHandler.getExitValue();
        LOGGER.info("tracejob exit value: " + exitValue);
        LOGGER.fine("tracejob output: " + out.toString());

        return new CommandOutput(out.toString(), err.toString());
    }
643944
public static String formatInput(Replaceable input,
                                     Transliterator.Position pos) {
        return formatInput((ReplaceableString) input, pos);
    }
503793
protected OkRequest<T> copy(final InputStream input, final OutputStream output) throws IOException {
        return new CloseOperation<OkRequest>(input, mIgnoreCloseExceptions) {

            @Override
            public OkRequest<T> call() throws IOException {
                boolean thrown = false;
                try {
                    final byte[] buffer = new byte[mBufferSize];
                    int read;
                    while ((read = input.read(buffer)) != -1) {
                        output.write(buffer, 0, read);
                    }
                    return OkRequest.this;
                } catch (IOException e) {
                    thrown = true;
                    throw e;
                } finally {
                    try {
                        done();
                    } catch (IOException e) {
                        if (!thrown) {
                            throw e;
                        }
                    }

                }

            }
        }.call();
    }
525071
private Input processRegularFileInput(String input) throws IOException {
    File inputFile = new File(input);
    if (!inputFile.exists()) {
      throw new IOException("Input does not exist: " + input);
    }
    if (pipeFiles) {
      SamReader samReader = SamReaderFactory.makeDefault().open(inputFile);
      return new Input(input, STDIN_FILE_NAME, 
          new SamReaderToSAMFilePump(samReader)); 
    } else {
      return new Input(input, input, null);
    }
  }
794129
private static Class<?> getNamedOutputKeyClass(JobContext job, String namedOutput) {
		return job.getConfiguration().getClass(MO_PREFIX + namedOutput + KEY, null, Object.class);
	}
198534
public static String getInputValueName(
            @Nullable final String inputPrefix,
            @Nonnull final BiMap<String, String> inputMapper,
            @Nonnull final String field) {
        String name = inputMapper == null ? null : inputMapper.inverse().get(field);
        if (name == null) {
            if (inputMapper != null && inputMapper.containsKey(field)) {
                throw new RuntimeException("field in keys");
            }
            final String[] defaultValues = {
                    Values.TASK_DIRECTORY_KEY, Values.CLIENT_HTTP_REQUEST_FACTORY_KEY,
                    Values.TEMPLATE_KEY, Values.PDF_CONFIG_KEY, Values.SUBREPORT_DIR_KEY,
                    Values.OUTPUT_FORMAT_KEY, Values.JOB_ID_KEY
            };
            if (inputPrefix == null || Arrays.asList(defaultValues).contains(field)) {
                name = field;
            } else {
                name = inputPrefix.trim() +
                        Character.toUpperCase(field.charAt(0)) +
                        field.substring(1);
            }
        }
        return name;
    }
618210
public static String encodeBrackets(final String input) {
		if (input == null || input.length() == 0) {  // For performance reasons don't use Util.empty
			return input;
		}
		return ENCODE_BRACKETS.translate(input);
	}
408674
@Override
    public AbstractPipelineOutput execute(final AbstractPipelineInput input) throws DITAOTException {
        final FileInfo fi = job.getFileInfo(f -> f.isInput).iterator().next();
        if (!ATTR_FORMAT_VALUE_DITAMAP.equals(fi.format)) {
            return null;
        }
        final File inputFile = new File(job.tempDirURI.resolve(fi.uri));
        final File styleFile = new File(input.getAttribute(ANT_INVOKER_EXT_PARAM_STYLE));

        Document doc;
        InputStream in = null;
        try {
            doc = XMLUtils.getDocumentBuilder().newDocument();
            final TransformerFactory transformerFactory = TransformerFactory.newInstance();
            transformerFactory.setURIResolver(CatalogUtils.getCatalogResolver());
            final Transformer transformer = withLogger(transformerFactory.newTransformer(new StreamSource(styleFile)), logger);
            transformer.setURIResolver(CatalogUtils.getCatalogResolver());
            if (input.getAttribute("include.rellinks") != null) {
                transformer.setParameter("include.rellinks", input.getAttribute("include.rellinks"));
            }
            transformer.setParameter("INPUTMAP", job.getInputMap());
            in = new BufferedInputStream(new FileInputStream(inputFile));
            final Source source = new StreamSource(in);
            source.setSystemId(inputFile.toURI().toString());
            final DOMResult result = new DOMResult(doc);
            transformer.transform(source, result);
        } catch (final RuntimeException e) {
            throw e;
        } catch (final Exception e) {
            throw new DITAOTException("Failed to read links from " + inputFile + ": " + e.getMessage(), e);
        } finally {
            if (in != null) {
                try {
                    in.close();
                } catch (final IOException e) {
                    logger.error("Failed to close input stream: " + e.getMessage(), e);
                }
            }
        }

        final Map<File, Map<String, Element>> mapSet = getMapping(doc);

        if (!mapSet.isEmpty()) {
            final DitaLinksWriter linkInserter = new DitaLinksWriter();
            linkInserter.setLogger(logger);
            linkInserter.setJob(job);
            for (final Map.Entry<File, Map<String, Element>> entry: mapSet.entrySet()) {
                final URI uri = inputFile.toURI().resolve(toURI(entry.getKey().getPath()));
                logger.info("Processing " + uri);
                linkInserter.setLinks(entry.getValue());
                linkInserter.setCurrentFile(uri);
                try {
                    linkInserter.write(new File(uri));
                } catch (final DITAOTException e) {
                    logger.error("Failed to insert links: " + e.getMessage(), e);
                }
            }
        }
        return null;
    }
872056
@Nonnull
  @Nonempty
  public String onStartJob (@Nonnull final ILongRunningJob aJob, @Nullable final String sStartingUserID)
  {
    ValueEnforcer.notNull (aJob, "Job");

    // Create a new unique in-memory ID
    final String sJobID = GlobalIDFactory.getNewStringID ();
    final LongRunningJobData aJobData = new LongRunningJobData (sJobID, aJob.getJobDescription (), sStartingUserID);
    m_aRWLock.writeLocked ( () -> m_aRunningJobs.put (sJobID, aJobData));
    return sJobID;
  }
443852
public static String substitute(Pattern pattern, String text, I_CmsRegexSubstitution sub) {

        StringBuffer buffer = new StringBuffer();
        Matcher matcher = pattern.matcher(text);
        while (matcher.find()) {
            matcher.appendReplacement(buffer, sub.substituteMatch(text, matcher));
        }
        matcher.appendTail(buffer);
        return buffer.toString();
    }
392055
public OkRequest<T> send(final InputStream input) throws IOException {

        openOutput();

        copy(input, mOutput);

        return this;
    }
729646
def _get_input_for_run(args, executable, preset_inputs=None, input_name_prefix=None):
    
    # The following may throw if the executable is a workflow with no
    # input spec available (because a stage is inaccessible)
    exec_inputs = try_call(ExecutableInputs,
                           executable,
                           input_name_prefix=input_name_prefix,
                           active_region=args.region)

    # Use input and system requirements from a cloned execution
    if args.input_json is None and args.filename is None:
        # --input-json and --input-json-file completely override input
        # from the cloned job
        exec_inputs.update(args.input_from_clone, strip_prefix=False)

    # Update with inputs passed to the this function
    if preset_inputs is not None:
        exec_inputs.update(preset_inputs, strip_prefix=False)

    # Update with inputs passed with -i, --input_json, --input_json_file, etc.
    # If batch_tsv is set, do not prompt for missing arguments
    require_all_inputs = (args.batch_tsv is None)
    try_call(exec_inputs.update_from_args, args, require_all_inputs)

    return exec_inputs.inputs
1338173
public RuntimeJobExecution createJobStartExecution(final WSJobInstance jobInstance,
                                                       IJobXMLSource jslSource,
                                                       Properties jobParameters,
                                                       long executionId) throws JobStartException {

        // TODO - redesign to avoid cast?
        final JobInstanceEntity jobInstanceImpl = (JobInstanceEntity) jobInstance;
        long instanceId = jobInstance.getInstanceId();

        ModelNavigator<JSLJob> navigator = createFirstExecution(jobInstanceImpl, jslSource, jobParameters);
        JobExecutionEntity jobExec = null;
        try {
            jobExec = getPersistenceManagerService().getJobExecutionMostRecent(instanceId);
            // Check to make sure the executionId belongs to the most recent execution.
            // If not, a restart may have occurred. So, fail the start.
            // Also check to make sure a stop did not come in while the start was on the queue.
            BatchStatus currentBatchStatus = jobExec.getBatchStatus();
            if (jobExec.getExecutionId() != executionId ||
                currentBatchStatus.equals(BatchStatus.STOPPING) ||
                currentBatchStatus.equals(BatchStatus.STOPPED)) {
                throw new JobStartException();
            }

        } catch (IllegalStateException ie) {
            // If no execution exists, request came from old dispatch path.  
            jobExec = getPersistenceManagerService().createJobExecution(instanceId, jobParameters, new Date());
            BatchEventsPublisher eventsPublisher = batchKernelImpl.getBatchEventsPublisher();
            if (eventsPublisher != null) {
                String correlationId = getCorrelationId(jobParameters);
                eventsPublisher.publishJobExecutionEvent(jobExec, BatchEventsPublisher.TOPIC_EXECUTION_STARTING, correlationId);
            }
        }

        TopLevelNameInstanceExecutionInfo topLevelInfo = new TopLevelNameInstanceExecutionInfo(jobInstanceImpl.getJobName(), instanceId, jobExec.getExecutionId());

        return new RuntimeJobExecution(topLevelInfo, jobParameters, navigator);
    }
741000
@Override
    public SmbPipeInputStream getInput () throws CIFSException {

        if ( !this.open ) {
            throw new SmbException("Already closed");
        }

        if ( this.input != null ) {
            return this.input;
        }

        try ( SmbTreeHandleImpl th = ensureTreeConnected() ) {
            this.input = new SmbPipeInputStream(this, th);
        }
        return this.input;
    }
882830
public static BufferedImage getImage(InputStream input) throws IOException
    {
        final BufferedImage buffer = ImageIO.read(input);
        if (buffer == null)
        {
            throw new IOException("Invalid image !");
        }
        return copyImage(buffer);
    }
911547
function (input) {
            if (typeof input !== 'undefined' && input !== null && input !== false) {
                master.emit('input', input, for_worker);
            } else {

                //No input? We might be done..

                var isComplete = function () {
                    //Check if any input was added dynamically
                    if (job.input.length > 0) {
                        job.is_complete = false;
                        return false;
                    }

                    //Wait for workers or instances that are still working
                    return worker_count > 0 ? areWorkersComplete() : job.instances <= 0;
                };

                //If we're not complete, check periodically
                if (isComplete()) {
                    master.emit('complete');
                } else {
                    completeCheckInterval = setInterval(function () {
                        if (isComplete()) {
                            clearInterval(completeCheckInterval);
                            master.emit('complete');
                        }
                    }, 300);
                }
            }
        }