GFacUtils.saveJobStatus(jobExecutionContext, details, JobState.UN_SUBMITTED);
applicationSaved=true;
String jobStatusMessage = "Un-submitted JobID= " + jobID;
log.info(jobStatusMessage);
jobExecutionContext.getNotifier().publish(new JobIDEvent(jobStatusMessage));
log.info("Two phase commit: sending COMMIT_REQUEST signal; Job id - " + jobID);
try {
job.signal(GramJob.SIGNAL_COMMIT_REQUEST);
} catch (GramException gramException) {
throw new GFacException("Error while sending commit request. Job Id - "
+ job.getIDAsString(), gramException);
} catch (GSSException gssException) {
// User credentials are invalid
log.error("Error while submitting commit request - Credentials provided are invalid. Job Id - "
+ job.getIDAsString(), e);
log.info("Attempting to renew credentials and re-submit commit signal...");
GFacUtils.saveErrorDetails(jobExecutionContext, gssException.getLocalizedMessage(), CorrectiveAction.RETRY_SUBMISSION, ErrorCategory.AIRAVATA_INTERNAL_ERROR);
renewCredentials(jobExecutionContext);
try {
job.signal(GramJob.SIGNAL_COMMIT_REQUEST);
} catch (GramException e1) {
GFacUtils.saveErrorDetails(jobExecutionContext, gssException.getLocalizedMessage(), CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.AIRAVATA_INTERNAL_ERROR);
throw new GFacException("Error while sending commit request. Job Id - "
+ job.getIDAsString(), e1);
} catch (GSSException e1) {
GFacUtils.saveErrorDetails(jobExecutionContext, gssException.getLocalizedMessage(), CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.AIRAVATA_INTERNAL_ERROR);
throw new GFacException("Error while sending commit request. Job Id - "
+ job.getIDAsString() + ". Credentials provided invalid", e1);
}
}
GFacUtils.updateJobStatus(jobExecutionContext, details, JobState.SUBMITTED);
jobStatusMessage = "Submitted JobID= " + job.getIDAsString();
log.info(jobStatusMessage);
jobExecutionContext.getNotifier().publish(new JobIDEvent(jobStatusMessage));
} catch (GSSException e) {
// Renew credentials and re-submit
GFacUtils.saveErrorDetails(jobExecutionContext, e.getLocalizedMessage(), CorrectiveAction.RETRY_SUBMISSION, ErrorCategory.AIRAVATA_INTERNAL_ERROR);
reSubmitJob(gateKeeper, jobExecutionContext, globusHostType, e);
} catch (GramException e) {
GFacUtils.saveErrorDetails(jobExecutionContext, e.getLocalizedMessage(), CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.AIRAVATA_INTERNAL_ERROR);
throw new GFacException("An error occurred while submitting a job, job id = " + job.getIDAsString(), e);
}
} else {
/*
* The first boolean is to force communication through SSLv3
* The second boolean is to specify the job is a batch job - use true for interactive and false for
* batch.
* The third boolean is to specify to use the full proxy and not delegate a limited proxy.
*/
try {
job.request(true, gateKeeper, false, false);
renewCredentialsAttempt = false;
} catch (GramException e) {
GFacUtils.saveErrorDetails(jobExecutionContext, e.getLocalizedMessage(), CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.AIRAVATA_INTERNAL_ERROR);
throw new GFacException("An error occurred while submitting a job, job id = " + job.getIDAsString(), e);
} catch (GSSException e) {
GFacUtils.saveErrorDetails(jobExecutionContext, e.getLocalizedMessage(), CorrectiveAction.RETRY_SUBMISSION, ErrorCategory.AIRAVATA_INTERNAL_ERROR);
// Renew credentials and re-submit
reSubmitJob(gateKeeper, jobExecutionContext, globusHostType, e);
}
String jobStatusMessage = "Un-submitted JobID= " + job.getIDAsString();
log.info(jobStatusMessage);
jobExecutionContext.getNotifier().publish(new JobIDEvent(jobStatusMessage));
}
currentlyExecutingJobCache.put(job.getIDAsString(), job);
/*