private boolean transitionState(JobStatus current, JobStatus newState) { return transitionState(current, newState, null); }
private boolean transitionState(JobStatus current, JobStatus newState) { return transitionState(current, newState, null); }
private boolean transitionState(JobStatus current, JobStatus newState) { return transitionState(current, newState, null); }
private boolean transitionState(JobStatus current, JobStatus newState) { return transitionState(current, newState, null); }
public void scheduleForExecution() throws JobException { if (transitionState(JobStatus.CREATED, JobStatus.RUNNING)) { switch (scheduleMode) { case LAZY_FROM_SOURCES: scheduleLazy(slotProvider); break; case EAGER: scheduleEager(slotProvider, scheduleAllocationTimeout); break; default: throw new JobException("Schedule mode is invalid."); } } else { throw new IllegalStateException("Job may only be scheduled from state " + JobStatus.CREATED); } }
checkState(JobStatus.CREATED.equals(curStatus), "Not allow reconcile in state " + curStatus); if (transitionState(curStatus, JobStatus.RECONCILING)) { List<CompletableFuture<ExecutionAttemptID>> executionReconcileFutures = new ArrayList<>(currentExecutions.size()); for (ExecutionVertex ev : getAllExecutionVertices()) { if (!transitionState(JobStatus.RECONCILING, JobStatus.CREATED)) { LOG.error("When reconcile finish, the job is in {}, this is a logical error.", state); else if (!transitionState(JobStatus.RECONCILING, JobStatus.RUNNING)) { LOG.error("When reconcile finish, the job is in {}, this is a logical error.", state);
public void scheduleForExecution() throws JobException { for (ExecutionJobVertex ejv : getAllVertices().values()) { ejv.setUpInputSplits(null); } final boolean enableSharedSlot = jobManagerConfiguration.getBoolean(JobManagerOptions.SLOT_ENABLE_SHARED_SLOT); if (enableSharedSlot) { updateSharedSlotResources(); } if (transitionState(JobStatus.CREATED, JobStatus.RUNNING)) { graphManager.startScheduling(); } else { throw new IllegalStateException("Job may only be scheduled from state " + JobStatus.CREATED); } }
if (transitionState(current, JobStatus.CANCELED)) { onTerminalState(JobStatus.CANCELED); break; if (transitionState(current, JobStatus.SUSPENDED)) { onTerminalState(JobStatus.SUSPENDED); break;
if (transitionState(current, JobStatus.CANCELED)) { onTerminalState(JobStatus.CANCELED); break; if (transitionState(current, JobStatus.SUSPENDED)) { onTerminalState(JobStatus.SUSPENDED); break;
} else if (transitionState(currentState, JobStatus.SUSPENDING, suspensionCause)) { initFailureCause(suspensionCause);
/** * Called whenever a vertex reaches state FINISHED (completed successfully). * Once all vertices are in the FINISHED state, the program is successfully done. */ void vertexFinished() { final int numFinished = verticesFinished.incrementAndGet(); if (numFinished == numVerticesTotal) { // done :-) // check whether we are still in "RUNNING" and trigger the final cleanup if (state == JobStatus.RUNNING) { // we do the final cleanup in the I/O executor, because it may involve // some heavier work try { for (ExecutionJobVertex ejv : verticesInCreationOrder) { ejv.getJobVertex().finalizeOnMaster(getUserClassLoader()); } } catch (Throwable t) { ExceptionUtils.rethrowIfFatalError(t); failGlobal(new Exception("Failed to finalize execution on master", t)); return; } // if we do not make this state transition, then a concurrent // cancellation or failure happened if (transitionState(JobStatus.RUNNING, JobStatus.FINISHED)) { onTerminalState(JobStatus.FINISHED); } } } }
/** * Called whenever a vertex reaches state FINISHED (completed successfully). * Once all vertices are in the FINISHED state, the program is successfully done. */ void vertexFinished() { final int numFinished = verticesFinished.incrementAndGet(); if (numFinished == numVerticesTotal) { // done :-) // check whether we are still in "RUNNING" and trigger the final cleanup if (state == JobStatus.RUNNING) { // we do the final cleanup in the I/O executor, because it may involve // some heavier work try { for (ExecutionJobVertex ejv : verticesInCreationOrder) { ejv.getJobVertex().finalizeOnMaster(getUserClassLoader()); } } catch (Throwable t) { ExceptionUtils.rethrowIfFatalError(t); failGlobal(new Exception("Failed to finalize execution on master", t)); return; } // if we do not make this state transition, then a concurrent // cancellation or failure happened if (transitionState(JobStatus.RUNNING, JobStatus.FINISHED)) { onTerminalState(JobStatus.FINISHED); } } } }
/** * Called whenever a vertex reaches state FINISHED (completed successfully). * Once all vertices are in the FINISHED state, the program is successfully done. */ void vertexFinished() { final int numFinished = verticesFinished.incrementAndGet(); if (numFinished == numVerticesTotal) { // done :-) // check whether we are still in "RUNNING" and trigger the final cleanup if (state == JobStatus.RUNNING) { // we do the final cleanup in the I/O executor, because it may involve // some heavier work try { for (ExecutionJobVertex ejv : verticesInCreationOrder) { ejv.getJobVertex().finalizeOnMaster(getUserClassLoader()); } } catch (Throwable t) { ExceptionUtils.rethrowIfFatalError(t); failGlobal(new Exception("Failed to finalize execution on master", t)); return; } // if we do not make this state transition, then a concurrent // cancellation or failure happened if (transitionState(JobStatus.RUNNING, JobStatus.FINISHED)) { onTerminalState(JobStatus.FINISHED); } } } }
if (transitionState(JobStatus.CREATED, JobStatus.RUNNING)) {
} else if (transitionState(currentState, JobStatus.SUSPENDING, suspensionCause)) { initFailureCause(suspensionCause);
/** * Called whenever a vertex reaches state FINISHED (completed successfully). * Once all vertices are in the FINISHED state, the program is successfully done. */ void vertexFinished() { final int numFinished = verticesFinished.incrementAndGet(); if (numFinished == numVerticesTotal) { // done :-) // check whether we are still in "RUNNING" and trigger the final cleanup if (state == JobStatus.RUNNING) { // we do the final cleanup in the I/O executor, because it may involve // some heavier work try { for (ExecutionJobVertex ejv : verticesInCreationOrder) { ejv.getJobVertex().finalizeOnMaster(getUserClassLoader()); } } catch (Throwable t) { ExceptionUtils.rethrowIfFatalError(t); failGlobal(new Exception("Failed to finalize execution on master", t)); return; } // if we do not make this state transition, then a concurrent // cancellation or failure happened if (transitionState(JobStatus.RUNNING, JobStatus.FINISHED)) { onTerminalState(JobStatus.FINISHED); } } } }
if (transitionState(JobStatus.CREATED, JobStatus.RUNNING)) {
} else if (transitionState(currentState, JobStatus.SUSPENDED, suspensionCause)) { this.failureCause = suspensionCause;
boolean isRestartable = isFailureCauseAllowingRestart && isRestartStrategyAllowingRestart; if (isRestartable && transitionState(currentState, JobStatus.RESTARTING)) { LOG.info("Restarting the job {} ({}).", getJobName(), getJobID()); else if (!isRestartable && transitionState(currentState, JobStatus.FAILED, failureCause)) { final String cause1 = isFailureCauseAllowingRestart ? null : "a type of SuppressRestartsException was thrown";
boolean isRestartable = isFailureCauseAllowingRestart && isRestartStrategyAllowingRestart; if (isRestartable && transitionState(currentState, JobStatus.RESTARTING)) { LOG.info("Restarting the job {} ({}).", getJobName(), getJobID()); else if (!isRestartable && transitionState(currentState, JobStatus.FAILED, failureCause)) { final String cause1 = isFailureCauseAllowingRestart ? null : "a type of SuppressRestartsException was thrown";