agave-jobs/jobs-core/src/main/java/org/iplantc/service/jobs/managers/monitors/parsers/TorqueXmlJobStatusResponseParser.java
/**
	 * The job status query to Torque was of the form {@code "qstat -a | grep ^<job_id>}. That means the response should
	 * come back in a tabbed column with the following fields
	 *
	 * <pre>
	 * JobID                         Username        Queue           Jobname         SessID   NDS  TSK   ReqMemory ReqTime  S ElapsedTime
	 * </pre>
	 *
	 * A sample matching status like will look like:
	 * <pre>
	 * 0.33cf4118fced          testuser    debug    torque.submit       --    --     --     --   00:01:00 Q       --
	 * </pre>
	 *
	 * It is sufficient to split the string and look at the value in column 10.
	 *
	 * @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
	 */
The job status query to Torque was of the form  "qstat -a | grep ^. That means the response should
come back in a tabbed column with the following fields





It is sufficient to split the string and look at the value in column 10.


The job status query to Torque was of the form " qstat - a | grep ^ . That means the response should come back in a tabbed column with the following fields It is sufficient to split the string and look at the value in column 10 .
@Override
	public JobStatusResponse parse(String remoteJobId, String schedulerResponseText) throws RemoteJobMonitorEmptyResponseException, RemoteJobMonitorResponseParsingException {
		if (StringUtils.isBlank(schedulerResponseText)) {
			throw new RemoteJobMonitorEmptyResponseException(
					"Empty response received from job status check on the remote system. Since the job was " +
							"successfully placed into queue, this is likely caused by a communication issue with the " +
							"scheduler. Retrying may clear up the issue.");
		} else if (schedulerResponseText.toLowerCase().contains("qstat: unknown job id")) {
			throw new RemoteJobMonitorEmptyResponseException(
					"Error response from job status check on the remote system. This is likely due to the job " +
							"completing and being purged from the qstat job cache. Calling tracejob with sufficient " +
							"permissions or examining the job logs should provide more information about the job.");
		} else {
			return parseXMLResponse(remoteJobId, schedulerResponseText);
		}
	}
@ Override public JobStatusResponse parse ( String remoteJobId , String schedulerResponseText ) throws RemoteJobMonitorEmptyResponseException , RemoteJobMonitorResponseParsingException { if ( StringUtils . isBlank ( schedulerResponseText ) ) { throw new RemoteJobMonitorEmptyResponseException ( "Empty response received from job status check on the remote system. Since the job was " + "successfully placed into queue, this is likely caused by a communication issue with the " + "scheduler. Retrying may clear up the issue." ) ; } else if ( schedulerResponseText . toLowerCase ( ) . contains ( "qstat: unknown job id" ) ) { throw new RemoteJobMonitorEmptyResponseException ( "Error response from job status check on the remote system. This is likely due to the job " + "completing and being purged from the qstat job cache. Calling tracejob with sufficient " + "permissions or examining the job logs should provide more information about the job." ) ; } else { return parseXMLResponse ( remoteJobId , schedulerResponseText ) ; } }
The job status query to Torque was of the form {@code "qstat -a | grep ^<job_id>}.
The job status query to Torque was of the form { @code " qstat - a | grep ^<job_id > } .
// otherwise, parse the XML response and return the resulting JobStatusResponse