Class ExecutionVertex
- java.lang.Object
-
- org.apache.flink.runtime.executiongraph.ExecutionVertex
-
- All Implemented Interfaces:
org.apache.flink.api.common.Archiveable<ArchivedExecutionVertex>
,AccessExecutionVertex
- Direct Known Subclasses:
SpeculativeExecutionVertex
public class ExecutionVertex extends Object implements AccessExecutionVertex, org.apache.flink.api.common.Archiveable<ArchivedExecutionVertex>
The ExecutionVertex is a parallel subtask of the execution. It may be executed once, or several times, each of which time it spawns anExecution
.
-
-
Field Summary
Fields Modifier and Type Field Description static long
NUM_BYTES_UNKNOWN
-
Constructor Summary
Constructors Constructor Description ExecutionVertex(ExecutionJobVertex jobVertex, int subTaskIndex, IntermediateResult[] producedDataSets, Duration timeout, long createTimestamp, int executionHistorySizeLimit, int initialAttemptCount)
Creates an ExecutionVertex.
-
Method Summary
-
-
-
Field Detail
-
NUM_BYTES_UNKNOWN
public static final long NUM_BYTES_UNKNOWN
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ExecutionVertex
@VisibleForTesting public ExecutionVertex(ExecutionJobVertex jobVertex, int subTaskIndex, IntermediateResult[] producedDataSets, Duration timeout, long createTimestamp, int executionHistorySizeLimit, int initialAttemptCount)
Creates an ExecutionVertex.- Parameters:
timeout
- The RPC timeout to use for deploy / cancel callscreateTimestamp
- The timestamp for the vertex creation, used to initialize the first Execution with.executionHistorySizeLimit
- The maximum number of historical Executions (= execution attempts) to keep.initialAttemptCount
- The attempt number of the first execution of this vertex.
-
-
Method Detail
-
getExecutionVertexInputInfo
public ExecutionVertexInputInfo getExecutionVertexInputInfo(IntermediateDataSetID resultId)
-
setInputBytes
public void setInputBytes(long inputBytes)
-
getInputBytes
public long getInputBytes()
-
getPartitionProducer
public Execution getPartitionProducer()
-
getJobId
public org.apache.flink.api.common.JobID getJobId()
-
getJobVertex
public ExecutionJobVertex getJobVertex()
-
getJobvertexId
public JobVertexID getJobvertexId()
-
getTaskName
public String getTaskName()
-
getTaskNameWithSubtaskIndex
public String getTaskNameWithSubtaskIndex()
Creates a simple name representation in the style 'taskname (x/y)', where 'taskname' is the name as returned bygetTaskName()
, 'x' is the parallel subtask index as returned bygetParallelSubtaskIndex()
+ 1
, and 'y' is the total number of tasks, as returned bygetTotalNumberOfParallelSubtasks()
.- Specified by:
getTaskNameWithSubtaskIndex
in interfaceAccessExecutionVertex
- Returns:
- A simple name representation in the form 'myTask (2/7)'
-
getTotalNumberOfParallelSubtasks
public int getTotalNumberOfParallelSubtasks()
-
getMaxParallelism
public int getMaxParallelism()
-
getResourceProfile
public ResourceProfile getResourceProfile()
-
getParallelSubtaskIndex
public int getParallelSubtaskIndex()
Description copied from interface:AccessExecutionVertex
Returns the subtask index of this execution vertex.- Specified by:
getParallelSubtaskIndex
in interfaceAccessExecutionVertex
- Returns:
- subtask index of this execution vertex.
-
getID
public ExecutionVertexID getID()
-
getNumberOfInputs
public int getNumberOfInputs()
-
getAllConsumedPartitionGroups
public List<ConsumedPartitionGroup> getAllConsumedPartitionGroups()
-
getConsumedPartitionGroup
public ConsumedPartitionGroup getConsumedPartitionGroup(int input)
-
getNextInputSplit
public Optional<org.apache.flink.core.io.InputSplit> getNextInputSplit(String host, int attemptNumber)
-
getCurrentExecutionAttempt
public Execution getCurrentExecutionAttempt()
Description copied from interface:AccessExecutionVertex
Returns the current execution for this execution vertex.- Specified by:
getCurrentExecutionAttempt
in interfaceAccessExecutionVertex
- Returns:
- current execution
-
getCurrentExecutions
public Collection<Execution> getCurrentExecutions()
Description copied from interface:AccessExecutionVertex
Returns the current executions for this execution vertex. The returned collection must contain the current execution attempt.- Specified by:
getCurrentExecutions
in interfaceAccessExecutionVertex
- Returns:
- current executions
-
getCurrentExecution
public Execution getCurrentExecution(int attemptNumber)
-
getExecutionState
public ExecutionState getExecutionState()
Description copied from interface:AccessExecutionVertex
Returns the currentExecutionState
for this execution vertex.- Specified by:
getExecutionState
in interfaceAccessExecutionVertex
- Returns:
- execution state for this execution vertex
-
getStateTimestamp
public long getStateTimestamp(ExecutionState state)
Description copied from interface:AccessExecutionVertex
Returns the timestamp for the givenExecutionState
.- Specified by:
getStateTimestamp
in interfaceAccessExecutionVertex
- Parameters:
state
- state for which the timestamp should be returned- Returns:
- timestamp for the given state
-
getFailureInfo
public Optional<ErrorInfo> getFailureInfo()
Description copied from interface:AccessExecutionVertex
Returns the exception that caused the job to fail. This is the first root exception that was not recoverable and triggered job failure.- Specified by:
getFailureInfo
in interfaceAccessExecutionVertex
- Returns:
- failure exception wrapped in an
Optional
ofErrorInfo
, or an emptyOptional
if no exception was caught.
-
getCurrentTaskManagerLocationFuture
public CompletableFuture<TaskManagerLocation> getCurrentTaskManagerLocationFuture()
-
getCurrentAssignedResource
public LogicalSlot getCurrentAssignedResource()
-
getCurrentAssignedResourceLocation
public TaskManagerLocation getCurrentAssignedResourceLocation()
Description copied from interface:AccessExecutionVertex
Returns theTaskManagerLocation
for this execution vertex.- Specified by:
getCurrentAssignedResourceLocation
in interfaceAccessExecutionVertex
- Returns:
- taskmanager location for this execution vertex.
-
getExecutionHistory
public ExecutionHistory getExecutionHistory()
Description copied from interface:AccessExecutionVertex
Returns the execution history.- Specified by:
getExecutionHistory
in interfaceAccessExecutionVertex
- Returns:
- the execution history
-
findLastLocation
public Optional<TaskManagerLocation> findLastLocation()
Gets the location that an execution of this vertex was assigned to.- Returns:
- The last execution location, or null, if there is none, yet.
-
findLastAllocation
public Optional<AllocationID> findLastAllocation()
-
getExecutionGraphAccessor
public final InternalExecutionGraphAccessor getExecutionGraphAccessor()
-
getProducedPartitions
public Map<IntermediateResultPartitionID,IntermediateResultPartition> getProducedPartitions()
-
addConsumedPartitionGroup
public void addConsumedPartitionGroup(ConsumedPartitionGroup consumedPartitions)
-
getPreferredLocationBasedOnState
public Optional<TaskManagerLocation> getPreferredLocationBasedOnState()
Gets the preferred location to execute the current task execution attempt, based on the state that the execution attempt will resume.
-
resetForNewExecution
public void resetForNewExecution()
Archives the current Execution and creates a new Execution for this vertex.
-
tryAssignResource
public void tryAssignResource(LogicalSlot slot)
-
deploy
public void deploy() throws JobException
- Throws:
JobException
-
deployToSlot
@VisibleForTesting public void deployToSlot(LogicalSlot slot) throws JobException
- Throws:
JobException
-
cancel
public CompletableFuture<?> cancel()
Cancels this ExecutionVertex.- Returns:
- A future that completes once the execution has reached its final state.
-
suspend
public CompletableFuture<?> suspend()
-
fail
public void fail(Throwable t)
-
markFailed
public void markFailed(Throwable t)
This method marks the task as failed, but will make no attempt to remove task execution from the task manager. It is intended for cases where the task is known not to be deployed yet.- Parameters:
t
- The exception that caused the task to fail.
-
finishPartitionsIfNeeded
@VisibleForTesting public List<IntermediateResultPartition> finishPartitionsIfNeeded()
Mark partition finished if needed.- Returns:
- list of finished partitions.
-
archive
public ArchivedExecutionVertex archive()
- Specified by:
archive
in interfaceorg.apache.flink.api.common.Archiveable<ArchivedExecutionVertex>
-
-