/** * Checks whether the current progress status matches any of the supplied * statuses. * @param states one or more states to match * @return <code>true</code> if progress status matches supplied statuses * @since 2.0 */ @Override public boolean isState(JobState... states) { JobState thisState = getState(); for (JobState state : states) { if (thisState == state) { return true; } } return false; }
private void initialize(boolean resumeIfIncomplete) throws IOException { JobSuiteStatusSnapshot statusTree = JobSuiteStatusSnapshot.newSnapshot(getSuiteIndexFile()); if (statusTree != null) { LOG.info("Previous execution detected."); MutableJobStatus status = (MutableJobStatus) statusTree.getRoot(); JobState state = status.getState(); ensureValidExecutionState(state); if (resumeIfIncomplete && !state.isOneOf( JobState.COMPLETED, JobState.PREMATURE_TERMINATION)) { LOG.info("Resuming from previous execution."); prepareStatusTreeForResume(statusTree); } else { // Back-up so we can start clean LOG.info("Backing up previous execution status and log files."); backupSuite(statusTree); statusTree = null; } } else { LOG.info("No previous execution detected."); } if (statusTree == null) { statusTree = JobSuiteStatusSnapshot.create( getRootJob(), getLogManager()); writeJobSuiteIndex(statusTree); } this.jobSuiteStatusSnapshot = statusTree; }
if (status.getState() == JobState.COMPLETED) { LOG.info("Job skipped: " + job.getId() + " (already completed)"); fire(jobLifeCycleListeners, "jobSkipped", status); if (status.getState() != JobState.STOPPING && status.getState() != JobState.STOPPED) { if (success) { fire(jobLifeCycleListeners, "jobCompleted", status);