synchronized private void failAllJobs(Throwable t) { String message = "Unexpected System Error Occured: "+ StringUtils.stringifyException(t); Iterator<ControlledJob> it = jobsInProgress.iterator(); while(it.hasNext()) { ControlledJob j = it.next(); try { j.failJob(message); } catch (IOException e) { LOG.error("Error while tyring to clean up "+j.getJobName(), e); } catch (InterruptedException e) { LOG.error("Error while tyring to clean up "+j.getJobName(), e); } finally { failedJobs.add(j); it.remove(); } } } }
synchronized private void failAllJobs(Throwable t) { String message = "Unexpected System Error Occured: "+ StringUtils.stringifyException(t); Iterator<ControlledJob> it = jobsInProgress.iterator(); while(it.hasNext()) { ControlledJob j = it.next(); try { j.failJob(message); } catch (IOException e) { LOG.error("Error while tyring to clean up "+j.getJobName(), e); } catch (InterruptedException e) { LOG.error("Error while tyring to clean up "+j.getJobName(), e); } finally { failedJobs.add(j); it.remove(); } } } }
synchronized private void failAllJobs(Throwable t) { String message = "Unexpected System Error Occured: "+ StringUtils.stringifyException(t); Iterator<ControlledJob> it = jobsInProgress.iterator(); while(it.hasNext()) { ControlledJob j = it.next(); try { j.failJob(message); } catch (IOException e) { LOG.error("Error while tyring to clean up "+j.getJobName(), e); } catch (InterruptedException e) { LOG.error("Error while tyring to clean up "+j.getJobName(), e); } finally { failedJobs.add(j); it.remove(); } } } }
/** * If stop_on_failure is enabled and any job has failed, it stops other jobs. * @param stop_on_failure whether it's enabled. * @return true if there were failed jobs and stop_on_failure is enabled */ private boolean stopJobsOnFailure(boolean stop_on_failure) throws IOException, InterruptedException { if (jc.getFailedJobs().isEmpty()) return false; if (stop_on_failure) { List<ControlledJob> readyJobsList = jc.getReadyJobsList(); List<ControlledJob> runningJobList = jc.getRunningJobList(); if (readyJobsList.size() > 0 || runningJobList.size() > 0) { log.info("Some job(s) failed. Failing other ready and running jobs as -stop_on_failure is on"); for (ControlledJob job : readyJobsList) { job.failJob("Failing ready job for -stop_on_failure: " + job.getMapredJobId()); } for (ControlledJob job : runningJobList) { job.failJob("Failing running job for -stop_on_failure: " + job.getMapredJobId()); } } return true; } return false; }
synchronized private void failAllJobs(Throwable t) { String message = "Unexpected System Error Occured: "+ StringUtils.stringifyException(t); Iterator<ControlledJob> it = jobsInProgress.iterator(); while(it.hasNext()) { ControlledJob j = it.next(); try { j.failJob(message); } catch (IOException e) { LOG.error("Error while tyring to clean up "+j.getJobName(), e); } catch (InterruptedException e) { LOG.error("Error while tyring to clean up "+j.getJobName(), e); } finally { failedJobs.add(j); it.remove(); } } } }