agave-jobs/jobs-core/src/main/java/org/iplantc/service/jobs/managers/monitors/parsers/PBSJobStatusResponseParser.java
/**
	 * Parses a job full status response from the remote server response. This should be the full multi-line response.
	 *
	 * @param remoteJobId the remote job id to parse from the response
	 * @param schedulerResponseText the full job status response for the job id
	 * @return a {@link JobStatusResponse} containing remote status info about the job with {@code remoteJobId}
	 * @throws RemoteJobMonitorResponseParsingException if unable to parse the job status
	 */
Parses a job full status response from the remote server response. This should be the full multi-line response.
@param remoteJobId the remote job id to parse from the response
@param schedulerResponseText the full job status response for the job id
@return a  JobStatusResponse containing remote status info about the job with  remoteJobId
@throws RemoteJobMonitorResponseParsingException if unable to parse the job status
Parses a job full status response from the remote server response . This should be the full multi - line response . @param remoteJobId the remote job id to parse from the response @param schedulerResponseText the full job status response for the job id @return a JobStatusResponse containing remote status info about the job with remoteJobId @throws RemoteJobMonitorResponseParsingException if unable to parse the job status
protected JobStatusResponse<PBSJobStatus> parseFullStatus(String remoteJobId, String schedulerResponseText) throws RemoteJobMonitorResponseParsingException {
		Properties props = new Properties();
		PBSJobStatus remoteJobStatus = PBSJobStatus.UNKNOWN;
		String exitCode = null;
		try (InputStream bis = new ByteArrayInputStream(schedulerResponseText.getBytes())) {
			props.load(bis);
			if (props.isEmpty()) {
				throw new RemoteJobMonitorResponseParsingException("Unable to find job status in the response from the scheduler");
			}
			Map.Entry<Object, Object> entry = getCaseInsensitiveEntry(props, "job");
			if (entry == null || ! entry.getValue().toString().toLowerCase().startsWith("id: " + remoteJobId + ".")) {
				throw new RemoteJobMonitorResponseParsingException("Unable to obtain job status in the response from the scheduler: " + props.getProperty("job"));
			}
			entry = getCaseInsensitiveEntry(props, "job_state");
			if (entry != null) {
				remoteJobStatus = PBSJobStatus.valueOfCode(entry.getValue().toString());
			} else {
				throw new RemoteJobMonitorResponseParsingException("Unable to find job status in the response from the scheduler");
			}
			entry = getCaseInsensitiveEntry(props, "exit_status");
			if (entry != null) {
				exitCode = entry.getValue().toString();
			}
			return new JobStatusResponse<>(remoteJobId, remoteJobStatus, exitCode);
		} catch (IOException e) {
			throw new RemoteJobMonitorResponseParsingException("Unable to parse the response from the scheduler");
		}
	}
protected JobStatusResponse < PBSJobStatus > parseFullStatus ( String remoteJobId , String schedulerResponseText ) throws RemoteJobMonitorResponseParsingException { Properties props = new Properties ( ) ; PBSJobStatus remoteJobStatus = PBSJobStatus . UNKNOWN ; String exitCode = null ; try ( InputStream bis = new ByteArrayInputStream ( schedulerResponseText . getBytes ( ) ) ) { props . load ( bis ) ; if ( props . isEmpty ( ) ) { throw new RemoteJobMonitorResponseParsingException ( "Unable to find job status in the response from the scheduler" ) ; } Map . Entry < Object , Object > entry = getCaseInsensitiveEntry ( props , "job" ) ; if ( entry == null || ! entry . getValue ( ) . toString ( ) . toLowerCase ( ) . startsWith ( "id: " + remoteJobId + "." ) ) { throw new RemoteJobMonitorResponseParsingException ( "Unable to obtain job status in the response from the scheduler: " + props . getProperty ( "job" ) ) ; } entry = getCaseInsensitiveEntry ( props , "job_state" ) ; if ( entry != null ) { remoteJobStatus = PBSJobStatus . valueOfCode ( entry . getValue ( ) . toString ( ) ) ; } else { throw new RemoteJobMonitorResponseParsingException ( "Unable to find job status in the response from the scheduler" ) ; } entry = getCaseInsensitiveEntry ( props , "exit_status" ) ; if ( entry != null ) { exitCode = entry . getValue ( ) . toString ( ) ; } return new JobStatusResponse < > ( remoteJobId , remoteJobStatus , exitCode ) ; } catch ( IOException e ) { throw new RemoteJobMonitorResponseParsingException ( "Unable to parse the response from the scheduler" ) ; } }
Parses a job full status response from the remote server response.
Parses a job full status response from the remote server response .
// if the response does not have a job id, reject due to parsing error