} catch (InterruptedException e1) {
e1.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
}
logger.error("Error handling the job with Job ID:" + currentMonitorID.getJobID());
throw new AiravataMonitorException(e);
} catch (SSHApiException e) {
logger.error(e.getMessage());
if (e.getMessage().contains("Unknown Job Id Error")) {
// in this case job is finished or may be the given job ID is wrong
jobStatus.setState(JobState.UNKNOWN);
publisher.publish(jobStatus);
} else if (e.getMessage().contains("illegally formed job identifier")) {
logger.error("Wrong job ID is given so dropping the job from monitoring system");
} else if (!this.queue.contains(take)) { // we put the job back to the queue only if its state is not unknown
if (currentMonitorID == null) {
logger.error("Monitoring the jobs failed, for user: " + take.getUserName()
+ " in Host: " + currentHostDescription.getType().getHostAddress());
} else {
if (currentMonitorID != null) {
if (currentMonitorID.getFailedCount() < 2) {
try {
currentMonitorID.setFailedCount(currentMonitorID.getFailedCount() + 1);
this.queue.put(take);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
} else {
logger.error(e.getMessage());
logger.error("Tried to monitor the job 3 times, so dropping of the the Job with ID: " + currentMonitorID.getJobID());
}
}
}
}
throw new AiravataMonitorException("Error retrieving the job status", e);
} catch (Exception e) {
if (currentMonitorID != null) {
if (currentMonitorID.getFailedCount() < 3) {
try {
currentMonitorID.setFailedCount(currentMonitorID.getFailedCount() + 1);
this.queue.put(take);
// if we get a wrong status we wait for a while and request again
Thread.sleep(10000);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
} else {
logger.error(e.getMessage());
logger.error("Tryied to monitor the job 3 times, so dropping of the the Job with ID: " + currentMonitorID.getJobID());
}
}
throw new AiravataMonitorException("Error retrieving the job status", e);
}
return true;
}