Repository: airavata Updated Branches: refs/heads/master 49eea6f15 -> 71de72f83
fixing qstat monitor exception handling Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/71de72f8 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/71de72f8 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/71de72f8 Branch: refs/heads/master Commit: 71de72f834907fdcc020909734d92c6f148b4552 Parents: 49eea6f Author: lahiru <[email protected]> Authored: Wed Apr 23 09:47:01 2014 -0400 Committer: lahiru <[email protected]> Committed: Wed Apr 23 09:47:01 2014 -0400 ---------------------------------------------------------------------- .../monitor/impl/pull/qstat/QstatMonitor.java | 44 +++++++++++--------- 1 file changed, 24 insertions(+), 20 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/71de72f8/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/pull/qstat/QstatMonitor.java ---------------------------------------------------------------------- diff --git a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/pull/qstat/QstatMonitor.java b/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/pull/qstat/QstatMonitor.java index 1ec45fe..b75b1c8 100644 --- a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/pull/qstat/QstatMonitor.java +++ b/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/pull/qstat/QstatMonitor.java @@ -190,33 +190,37 @@ public class QstatMonitor extends PullMonitor { logger.error("Monitoring the jobs failed, for user: " + take.getUserName() + " in Host: " + currentHostDescription.getType().getHostAddress()); } else { - if (currentMonitorID.getFailedCount() < 2) { - try { - currentMonitorID.setFailedCount(currentMonitorID.getFailedCount() + 1); - this.queue.put(take); - } catch (InterruptedException e1) { - e1.printStackTrace(); + 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()); } - } 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.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(); + 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()); } - } 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); }
