Class TaskExecutionState

java.lang.Object
org.apache.flink.runtime.taskmanager.TaskExecutionState
All Implemented Interfaces:
Serializable

public class TaskExecutionState extends Object implements Serializable
This class represents an update about a task's execution state.

NOTE: The exception that may be attached to the state update is not necessarily a Flink or core Java exception, but may be an exception from the user code. As such, it cannot be deserialized without a special class loader. For that reason, the class keeps the actual exception field transient and deserialized it lazily, with the appropriate class loader.

See Also:
  • Constructor Details

    • TaskExecutionState

      public TaskExecutionState(ExecutionAttemptID executionId, ExecutionState executionState)
      Creates a new task execution state update, with no attached exception and no accumulators.
      Parameters:
      executionId - the ID of the task execution whose state is to be reported
      executionState - the execution state to be reported
    • TaskExecutionState

      public TaskExecutionState(ExecutionAttemptID executionId, ExecutionState executionState, Throwable error)
      Creates a new task execution state update, with an attached exception but no accumulators.
      Parameters:
      executionId - the ID of the task execution whose state is to be reported
      executionState - the execution state to be reported
    • TaskExecutionState

      public TaskExecutionState(ExecutionAttemptID executionId, ExecutionState executionState, Throwable error, AccumulatorSnapshot accumulators, IOMetrics ioMetrics)
      Creates a new task execution state update, with an attached exception. This constructor may never throw an exception.
      Parameters:
      executionId - the ID of the task execution whose state is to be reported
      executionState - the execution state to be reported
      error - an optional error
      accumulators - The flink and user-defined accumulators which may be null.
  • Method Details

    • getError

      public Throwable getError(ClassLoader userCodeClassloader)
      Gets the attached exception, which is in serialized form. Returns null, if the status update is no failure with an associated exception.
      Parameters:
      userCodeClassloader - The classloader that can resolve user-defined exceptions.
      Returns:
      The attached exception, or null, if none.
    • getID

      public ExecutionAttemptID getID()
      Returns the ID of the task this result belongs to
      Returns:
      the ID of the task this result belongs to
    • getExecutionState

      public ExecutionState getExecutionState()
      Returns the new execution state of the task.
      Returns:
      the new execution state of the task
    • getAccumulators

      public AccumulatorSnapshot getAccumulators()
      Gets flink and user-defined accumulators in serialized form.
    • getIOMetrics

      public IOMetrics getIOMetrics()
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object