public ArchivedExecution(Execution execution) { this( execution.getUserAccumulatorsStringified(), execution.getIOMetrics(), execution.getAttemptId(), execution.getAttemptNumber(), execution.getState(), ExceptionUtils.stringifyException(execution.getFailureCause()), execution.getAssignedResourceLocation(), execution.getAssignedAllocationID(), execution.getVertex().getParallelSubtaskIndex(), execution.getStateTimestamps()); }
public void cachePartitionInfo(PartialInputChannelDeploymentDescriptor partitionInfo){ getCurrentExecutionAttempt().cachePartitionInfo(partitionInfo); }
/** * Cancels this ExecutionVertex. * * @return A future that completes once the execution has reached its final state. */ public CompletableFuture<?> cancel() { // to avoid any case of mixup in the presence of concurrent calls, // we copy a reference to the stack to make sure both calls go to the same Execution final Execution exec = this.currentExecution; exec.cancel(); return exec.getReleaseFuture(); }
/** * * @return A future that completes once the execution has reached its final state. */ public Future<ExecutionState> cancel() { // to avoid any case of mixup in the presence of concurrent calls, // we copy a reference to the stack to make sure both calls go to the same Execution final Execution exec = this.currentExecution; exec.cancel(); return exec.getTerminationFuture(); }
if (transitionState(current, FINISHED)) { try { getVertex().finishPartitionsAndNotify(); updateAccumulatorsAndMetrics(userAccumulators, metrics); releaseAssignedResource(null); cancelingComplete(userAccumulators, metrics); return; markFailed(new Exception("Vertex received FINISHED message while being in state " + state)); return;
LOG.debug("Ignoring transition of vertex {} to {} while being {}.", getVertexWithAttempt(), FAILED, current); cancelingComplete(userAccumulators, metrics); return false; if (transitionState(current, FAILED, t)) { updateAccumulatorsAndMetrics(userAccumulators, metrics); releaseAssignedResource(t); vertex.getExecutionGraph().deregisterExecution(this); sendCancelRpcCall(); LOG.error("Error triggering cancel call while marking task {} as failed.", getVertex().getTaskNameWithSubtaskIndex(), tt);
boolean result = attempt.switchToRunning(); if(result) { taskDeployMetrics.update( attempt.getStateTimestamp(ExecutionState.RUNNING) - attempt.getStateTimestamp(ExecutionState.DEPLOYING)); attempt.markFinished(accumulators, state.getIOMetrics()); return true; attempt.cancelingComplete(accumulators, state.getIOMetrics()); return true; attempt.markFailed(state.getError(userClassLoader), accumulators, state.getIOMetrics()); return true; attempt.fail(new Exception("TaskManager sent illegal state update: " + state.getExecutionState())); return false;
fail(new IllegalStateException("Currently, only a single consumer group per partition is supported.")); final ExecutionState consumerState = consumer.getState(); final LogicalSlot consumerSlot = consumer.getAssignedResource(); partitionId, partitionLocation); consumer.sendUpdatePartitionInfoRpcCall( Collections.singleton( new PartitionInfo(
final Execution producer = consumedPartition.getProducer().getCurrentExecutionAttempt(); final ExecutionState producerState = producer.getState(); final LogicalSlot producerSlot = producer.getAssignedResource(); consumedPartition.getPartitionId(), producer.getAttemptId());
LOG.debug("Ignoring transition of vertex {} to {} while being {}.", getVertexWithAttempt(), FAILED, current); cancelingComplete(userAccumulators, metrics); return false; if (transitionState(current, FAILED, t)) { updateAccumulatorsAndMetrics(userAccumulators, metrics); sendCancelRpcCall();
updateAccumulatorsAndMetrics(userAccumulators, metrics); if (transitionState(current, CANCELED)) { try { releaseAssignedResource(new FlinkException("Execution " + this + " was cancelled."));
final ExecutionState oldState = oldExecution.getState(); priorExecutions.add(oldExecution.archive()); final Execution newExecution = new Execution( getExecutionGraph().getFutureExecutor(), this, oldExecution.getAttemptNumber() + 1, originatingGlobalModVersion, timestamp,
@Override public CompletableFuture<ExecutionState> requestPartitionState( final IntermediateDataSetID intermediateResultId, final ResultPartitionID resultPartitionId) { final Execution execution = executionGraph.getRegisteredExecutions().get(resultPartitionId.getProducerId()); if (execution != null) { return CompletableFuture.completedFuture(execution.getState()); } else { final IntermediateResult intermediateResult = executionGraph.getAllIntermediateResults().get(intermediateResultId); if (intermediateResult != null) { // Try to find the producing execution Execution producerExecution = intermediateResult .getPartitionById(resultPartitionId.getPartitionId()) .getProducer() .getCurrentExecutionAttempt(); if (producerExecution.getAttemptId().equals(resultPartitionId.getProducerId())) { return CompletableFuture.completedFuture(producerExecution.getState()); } else { return FutureUtils.completedExceptionally(new PartitionProducerDisposedException(resultPartitionId)); } } else { return FutureUtils.completedExceptionally(new IllegalArgumentException("Intermediate data set with ID " + intermediateResultId + " not found.")); } } }
/** * Creates a partial input channel for the given partition and producing task. */ public static PartialInputChannelDeploymentDescriptor fromEdge( IntermediateResultPartition partition, Execution producer) { final ResultPartitionID partitionId = new ResultPartitionID( partition.getPartitionId(), producer.getAttemptId()); final IntermediateResult result = partition.getIntermediateResult(); final TaskManagerLocation partitionConnectionInfo = producer.getAssignedResourceLocation(); return new PartialInputChannelDeploymentDescriptor( result, partitionId, partitionConnectionInfo); } }
final ExecutionState oldState = oldExecution.getState(); latestPriorLocation = oldExecution.getAssignedResourceLocation(); final Execution newExecution = new Execution( getExecutionGraph().getFutureExecutor(), this, oldExecution.getAttemptNumber() + 1, originatingGlobalModVersion, timestamp,
final Slot slot = execution.getAssignedResource(); final int taskId = execution.getVertex().getParallelSubtaskIndex(); final String host = slot != null ? slot.getTaskManagerLocation().getHostname() : null; final InputSplit nextInputSplit = splitAssigner.getNextInputSplit(host, taskId);
@Override public void onTaskFailure(Execution taskExecution, Throwable cause) { final ExecutionVertex ev = taskExecution.getVertex(); final FailoverRegion failoverRegion = vertexToRegion.get(ev); if (failoverRegion == null) { executionGraph.failGlobal(new FlinkException( "Can not find a failover region for the execution " + ev.getTaskNameWithSubtaskIndex(), cause)); } else { LOG.info("Recovering task failure for {} #{} ({}) via restart of failover region", taskExecution.getVertex().getTaskNameWithSubtaskIndex(), taskExecution.getAttemptNumber(), taskExecution.getAttemptId()); failoverRegion.onExecutionFail(taskExecution, cause); } }
/** * Recover the pipelined result partition consume status after job master failover. * * @param resultId The intermediate data set id in the log. */ public void recoverResultPartitionStatus( IntermediateDataSetID resultId, TaskManagerLocation location) { IntermediateResultPartition partitionToRecover = null; for (IntermediateResultPartition irp : getProducedPartitions().values()) { if (irp.getIntermediateResult().getId().equals(resultId)) { partitionToRecover = irp; } } if (partitionToRecover == null) { throw new FlinkRuntimeException("Can not find the intermediate result " + resultId + " on " + getTaskNameWithSubtaskIndex()); } if (!(ExecutionState.RUNNING.equals(currentExecution.getState()) && partitionToRecover.getResultType().isPipelined())) { throw new FlinkRuntimeException("Invalid state " + currentExecution.getState() + " for " + getTaskNameWithSubtaskIndex()); } currentExecution.getTaskManagerLocationFuture().complete(location); scheduleOrUpdateConsumers(new ResultPartitionID(partitionToRecover.getPartitionId(), currentExecution.getAttemptId())); }
void registerExecution(Execution exec) { Execution previous = currentExecutions.putIfAbsent(exec.getAttemptId(), exec); if (previous != null) { failGlobal(new Exception("Trying to register execution " + exec + " for already used ID " + exec.getAttemptId())); } }
public void fail(Throwable t) { this.currentExecution.fail(t); }