agave-jobs/jobs-core/src/main/java/org/iplantc/service/jobs/managers/monitors/parsers/CondorJobStatusResponseParser.java
/**
     * Parses the file into sections based on predefined section headers and footers. A section header
     * follows the general pattern:
     *
     * <pre>
     * 000 (154.000.000) 01/31 14:27:43 Job submitted from host: <192.168.10.1:56091>
     * </pre>
     *
     * The First three digits of the header line mark the beginning of a section and indicate the condor status code
     * determining the job satus. A section break contains a single line with three periods, "...".
     *
     * A full log file for a test job will resemble the following:
     * <pre>
     * 000 (007.000.000) 05/27 11:27:01 Job submitted from host: <172.19.0.18:36901?addrs=172.19.0.18-36901>
     * ...
     * 001 (007.000.000) 05/27 11:27:04 Job executing on host: <172.19.0.18:49543?addrs=172.19.0.18-49543>
     * ...
     * 006 (007.000.000) 05/27 11:27:08 Image size of job updated: 1
     *         0  -  MemoryUsage of job (MB)
     *         0  -  ResidentSetSize of job (KB)
     * ...
     * 005 (007.000.000) 05/27 11:27:08 Job terminated.
     *         (1) Normal termination (return value 0)
     *                 Usr 0 00:00:00, Sys 0 00:00:00  -  Run Remote Usage
     *                 Usr 0 00:00:00, Sys 0 00:00:00  -  Run Local Usage
     *                 Usr 0 00:00:00, Sys 0 00:00:00  -  Total Remote Usage
     *                 Usr 0 00:00:00, Sys 0 00:00:00  -  Total Local Usage
     *         10325  -  Run Bytes Sent By Job
     *         6396  -  Run Bytes Received By Job
     *         10325  -  Total Bytes Sent By Job
     *         6396  -  Total Bytes Received By Job
     *         Partitionable Resources :    Usage  Request Allocated
     *            Cpus                 :                 1         1
     *            Disk (KB)            :       22       12  26480434
     *            Memory (MB)          :        0     1024      4004
     * ...
     * </pre>
     * @param remoteJobId           the remote job id to parse from the response
     * @param schedulerResponseText the response text from the remote scheduler
     * @return a {@link JobStatusResponse} containing remote status info about the job with {@code remoteJobId}
     * @throws RemoteJobMonitorEmptyResponseException if {@code schedulerResponseText} is blank
     * @throws RemoteJobMonitorResponseParsingException if {@code schedulerResponseText} could not be parsed
     *
     */
Parses the file into sections based on predefined section headers and footers. A section header
follows the general pattern.



The First three digits of the header line mark the beginning of a section and indicate the condor status code
determining the job satus. A section break contains a single line with three periods, "...".


Parses the file into sections based on predefined section headers and footers . A section header follows the general pattern . The First three digits of the header line mark the beginning of a section and indicate the condor status code determining the job satus . A section break contains a single line with three periods " ... " .
public JobStatusResponse parse(String remoteJobId, String schedulerResponseText) throws RemoteJobMonitorEmptyResponseException, RemoteJobMonitorResponseParsingException {
        schedulerResponseText = StringUtils.stripToEmpty(schedulerResponseText);
        if (schedulerResponseText.isEmpty()) {
            throw new RemoteJobMonitorEmptyResponseException(
                    "Empty response received from job status check on the remote system.");
        } else {
            String[] logEventSections = schedulerResponseText.split(CONDOR_LOG_EVENT_DELIMITER_REGEX);
            if (!isValidLogFile(logEventSections[0])) {
                throw new RemoteJobMonitorResponseParsingException("Invalid Condor log file format. " +
                        "No section header found on the first line.");
            }
            return parseLogEventSection(remoteJobId, logEventSections[logEventSections.length - 1]);
        }
    }
public JobStatusResponse parse ( String remoteJobId , String schedulerResponseText ) throws RemoteJobMonitorEmptyResponseException , RemoteJobMonitorResponseParsingException { schedulerResponseText = StringUtils . stripToEmpty ( schedulerResponseText ) ; if ( schedulerResponseText . isEmpty ( ) ) { throw new RemoteJobMonitorEmptyResponseException ( "Empty response received from job status check on the remote system." ) ; } else { String [ ] logEventSections = schedulerResponseText . split ( CONDOR_LOG_EVENT_DELIMITER_REGEX ) ; if ( ! isValidLogFile ( logEventSections [ 0 ] ) ) { throw new RemoteJobMonitorResponseParsingException ( "Invalid Condor log file format. " + "No section header found on the first line." ) ; } return parseLogEventSection ( remoteJobId , logEventSections [ logEventSections . length - 1 ] ) ; } }
Parses the file into sections based on predefined section headers and footers.
Parses the file into sections based on predefined section headers and footers .
// split the response into individual condor log events // The string was not empty, so we know the split array will have at least one value, // thus no null check is required. We sanity check the first value to make sure the // file is an actual runtime log file. // parse the last section in the event log as that contains the current job status.