agave-jobs/jobs-core/src/main/java/org/iplantc/service/jobs/managers/JobRequestProcessor.java
/**
	 * Validates the storage credentials of the execution system.
	 * @param executionSystem the system on which the job will be run
	 * @throws JobProcessingException if the system credentials are bad or the system is unavailable
	 */
Validates the storage credentials of the execution system.
@param executionSystem the system on which the job will be run
@throws JobProcessingException if the system credentials are bad or the system is unavailable
Validates the storage credentials of the execution system . @param executionSystem the system on which the job will be run @throws JobProcessingException if the system credentials are bad or the system is unavailable
public boolean checkExecutionSystemStorage(ExecutionSystem executionSystem) throws JobProcessingException {
		JobManager manager = getJobManager();
		try {
			Instant lastAccess = manager.getLastSuccessfulSystemAccess(executionSystem);
			AuthConfig authConfig = getExecutionSystem().getStorageConfig().getAuthConfigForInternalUsername(getInternalUsername());
			String salt = getExecutionSystem().getEncryptionKeyForAuthConfig(authConfig);
			if (authConfig.isCredentialExpired(salt))
			{
				String msg = "Credential for " + getExecutionSystem().getSystemId() + " is not active." +
						" Please add a valid " + getExecutionSystem().getStorageConfig().getType() +
						" storage credential for the execution system and resubmit the job.";
				log.error(msg);
				throw new JobProcessingException(412, msg);
			}
			RemoteDataClient remoteExecutionDataClient = null;
			try {
				remoteExecutionDataClient = getExecutionSystem().getRemoteDataClient(getInternalUsername());
				remoteExecutionDataClient.authenticate();
				manager.setLastSuccessfulSystemAccess(executionSystem, Instant.now());
			} catch (Throwable e) {
				String msg = "Unable to authenticate to " + getExecutionSystem().getSystemId() + " with the " +
						(authConfig.isSystemDefault() ? "default " : "internal user " + getInternalUsername()) +
						"credential. Please check the " + getExecutionSystem().getLoginConfig().getType() +
						" execution credential for the execution system and resubmit the job.";
				log.error(msg, e);
				throw new JobProcessingException(412, msg);
			} finally {
				try {
					if (remoteExecutionDataClient != null) {
						remoteExecutionDataClient.disconnect();
					}
				} catch (Exception ignored) {}
			}
		} catch (JobProcessingException e) {
			manager.setLastSuccessfulSystemAccess(executionSystem, null);
			throw e;
		}
		return true;
	}
public boolean checkExecutionSystemStorage ( ExecutionSystem executionSystem ) throws JobProcessingException { JobManager manager = getJobManager ( ) ; try { Instant lastAccess = manager . getLastSuccessfulSystemAccess ( executionSystem ) ; AuthConfig authConfig = getExecutionSystem ( ) . getStorageConfig ( ) . getAuthConfigForInternalUsername ( getInternalUsername ( ) ) ; String salt = getExecutionSystem ( ) . getEncryptionKeyForAuthConfig ( authConfig ) ; if ( authConfig . isCredentialExpired ( salt ) ) { String msg = "Credential for " + getExecutionSystem ( ) . getSystemId ( ) + " is not active." + " Please add a valid " + getExecutionSystem ( ) . getStorageConfig ( ) . getType ( ) + " storage credential for the execution system and resubmit the job." ; log . error ( msg ) ; throw new JobProcessingException ( 412 , msg ) ; } RemoteDataClient remoteExecutionDataClient = null ; try { remoteExecutionDataClient = getExecutionSystem ( ) . getRemoteDataClient ( getInternalUsername ( ) ) ; remoteExecutionDataClient . authenticate ( ) ; manager . setLastSuccessfulSystemAccess ( executionSystem , Instant . now ( ) ) ; } catch ( Throwable e ) { String msg = "Unable to authenticate to " + getExecutionSystem ( ) . getSystemId ( ) + " with the " + ( authConfig . isSystemDefault ( ) ? "default " : "internal user " + getInternalUsername ( ) ) + "credential. Please check the " + getExecutionSystem ( ) . getLoginConfig ( ) . getType ( ) + " execution credential for the execution system and resubmit the job." ; log . error ( msg , e ) ; throw new JobProcessingException ( 412 , msg ) ; } finally { try { if ( remoteExecutionDataClient != null ) { remoteExecutionDataClient . disconnect ( ) ; } } catch ( Exception ignored ) { } } } catch ( JobProcessingException e ) { manager . setLastSuccessfulSystemAccess ( executionSystem , null ) ; throw e ; } return true ; }
Validates the storage credentials of the execution system.
Validates the storage credentials of the execution system .
// look up the last update time. We can skip the check if it's been access in the last few minutes. // set the lat successful update time on this system // clear the last successful update time as it failed here