ExecutionPhase ep = jobUpdater.getPhase(jobID); log.debug("GET: " + jobID + " " + ep.name()); response.setStatus(HttpServletResponse.SC_OK); ExecutionPhase result = null; if (err != null) result = jobUpdater.setPhase(jobID, cur, end, err, new Date()); else result = jobUpdater.setPhase(jobID, cur, end, new Date()); ExecutionPhase actual = jobUpdater.getPhase(jobID); log.debug("cannot change phase of " + jobID + " from " + cur + " to " + end + "(was: " + actual + ") [FAIL]"); throw new IllegalArgumentException("cannot change phase of " + jobID + " from " + cur + " to " + end + "(was: " + actual + ")");
ExecutionPhase ep = jobUpdater.setPhase(job.getID(), ExecutionPhase.PENDING, ExecutionPhase.ABORTED, new Date()); if (!ExecutionPhase.ABORTED.equals(ep)) ep = jobUpdater.setPhase(job.getID(), ExecutionPhase.QUEUED, ExecutionPhase.ABORTED, new Date()); if (!ExecutionPhase.ABORTED.equals(ep)) ep = jobUpdater.setPhase(job.getID(), ExecutionPhase.EXECUTING, ExecutionPhase.ABORTED, new Date()); if (!ExecutionPhase.ABORTED.equals(ep)) return; // no phase change - do nothing
log.debug("execute: " + job.getID() + " sync=" + (sync != null)); log.debug(job.getID() + ": PENDING -> QUEUED"); ExecutionPhase ep = jobUpdater.setPhase(job.getID(), ExecutionPhase.PENDING, ExecutionPhase.QUEUED); if (!ExecutionPhase.QUEUED.equals(ep)) ExecutionPhase actual = jobUpdater.getPhase(job.getID()); log.debug(job.getID() + ": PENDING -> QUEUED [FAILED] -- was " + actual); throw new JobPhaseException("cannot execute job " + job.getID() + " when phase = " + actual);
private void doit() { try { try { ExecutionPhase ep = jobUpdater.setPhase(job.getID(), ExecutionPhase.QUEUED, ExecutionPhase.EXECUTING, new Date()); if (!ExecutionPhase.EXECUTING.equals(ep)) { ep = jobUpdater.getPhase(job.getID()); log.debug(job.getID() + ": QUEUED -> EXECUTING [FAILED] -- phase is " + ep); logInfo.setSuccess(false); ep = jobUpdater.setPhase(job.getID(), ExecutionPhase.EXECUTING, ExecutionPhase.COMPLETED, new Date()); logInfo.setSuccess(true); } catch (AccessControlException ex) { logInfo.setSuccess(true); ErrorSummary es = new ErrorSummary(ex.getMessage(), ErrorType.FATAL); jobUpdater.setPhase(job.getID(), ExecutionPhase.EXECUTING, ExecutionPhase.ERROR, es, new Date()); } catch (IllegalArgumentException ex) { logInfo.setMessage(ex.getMessage()); logInfo.setSuccess(true); ErrorSummary es = new ErrorSummary(ex.getMessage(), ErrorType.FATAL); jobUpdater.setPhase(job.getID(), ExecutionPhase.EXECUTING, ExecutionPhase.ERROR, es, new Date()); } catch (RuntimeException ex) { logInfo.setMessage(ex.getMessage()); logInfo.setSuccess(false); ErrorSummary es = new ErrorSummary("unexpected failure: " + ex.getMessage(), ErrorType.FATAL); jobUpdater.setPhase(job.getID(), ExecutionPhase.EXECUTING, ExecutionPhase.ERROR, es, new Date()); try { ErrorSummary es = new ErrorSummary("unexpected failure: " + unexpected, ErrorType.FATAL); jobUpdater.setPhase(job.getID(), ExecutionPhase.EXECUTING, ExecutionPhase.ERROR, es, new Date());
ExecutionPhase ep = jobUpdater.setPhase(job.getID(), ExecutionPhase.QUEUED, ExecutionPhase.EXECUTING, new Date()); if ( !ExecutionPhase.EXECUTING.equals(ep) ) ep = jobUpdater.getPhase(job.getID()); log.debug(job.getID() + ": QUEUED -> EXECUTING [FAILED] -- phase is " + ep); logInfo.setSuccess(false); ep = jobUpdater.getPhase(job.getID()); if (ExecutionPhase.ABORTED.equals(ep)) jobUpdater.setPhase(job.getID(), ExecutionPhase.EXECUTING, ExecutionPhase.COMPLETED, diagnostics, new Date()); diagnostics.add(res); log.debug("[async] setting ExecutionPhase = " + ExecutionPhase.COMPLETED + " result+diag: " + diagnostics.size()); jobUpdater.setPhase(job.getID(), ExecutionPhase.EXECUTING, ExecutionPhase.COMPLETED, diagnostics, new Date()); log.debug("setting ExecutionPhase = " + ExecutionPhase.ERROR); jobUpdater.setPhase(job.getID(), ExecutionPhase.EXECUTING, ExecutionPhase.ERROR, es, new Date()); jobUpdater.setPhase(job.getID(), ExecutionPhase.EXECUTING, ExecutionPhase.ERROR, es, new Date());