}
}
public void executeApplication(InvocationContext invocationContext) throws ProviderException {
GlobusHostType host = (GlobusHostType) invocationContext.getExecutionDescription().getHost().getType();
ApplicationDeploymentDescriptionType app = invocationContext.getExecutionDescription().getApp().getType();
StringBuffer buf = new StringBuffer();
try {
/*
* Set Security
*/
GSSCredential gssCred = gssContext.getGssCredentails();
job.setCredentials(gssCred);
log.info("Request to contact:" + gateKeeper);
buf.append("Finished launching job, Host = ").append(host.getHostAddress()).append(" RSL = ")
.append(job.getRSL()).append(" working directory = ").append(app.getStaticWorkingDirectory())
.append(" tempDirectory = ").append(app.getScratchWorkingDirectory())
.append(" Globus GateKeeper cantact = ").append(gateKeeper);
invocationContext.getExecutionContext().getNotifier().info(invocationContext, buf.toString());
/*
* The first boolean is to specify the job is a batch job - use true for interactive and false for batch.
* The second boolean is to specify to use the full proxy and not delegate a limited proxy.
*/
job.request(gateKeeper, false, false);
String gramJobid = job.getIDAsString();
log.info("JobID = " + gramJobid);
invocationContext.getExecutionContext().getNotifier().info(invocationContext, "JobID=" + gramJobid);
log.info(buf.toString());
invocationContext
.getExecutionContext()
.getNotifier()
.applicationInfo(invocationContext, gramJobid, gateKeeper, null, null,
gssCred.getName().toString(), null, job.getRSL());
/*
* Block untill job is done
*/
listener.waitFor();
/*
* Remove listener
*/
job.removeListener(listener);
/*
* Fail job
*/
int jobStatus = listener.getStatus();
if (jobStatus == GramJob.STATUS_FAILED) {
int errCode = listener.getError();
String errorMsg = "Job " + job.getID() + " on host " + host.getHostAddress() + " Error Code = "
+ errCode;
JobSubmissionFault error = new JobSubmissionFault(this, new Exception(errorMsg), "GFAC HOST",
gateKeeper, job.getRSL());
if (errCode == 8) {
error.setReason(JobSubmissionFault.JOB_CANCEL);
} else {
error.setReason(JobSubmissionFault.JOB_FAILED);
}
throw error;
}
} catch (GramException e) {
JobSubmissionFault error = new JobSubmissionFault(this, e, host.getHostAddress(), gateKeeper, job.getRSL());
if (listener.getError() == 8) {
error.setReason(JobSubmissionFault.JOB_CANCEL);
} else {
error.setReason(JobSubmissionFault.JOB_FAILED);
}