Class TaskStatus

java.lang.Object
org.apache.druid.indexer.TaskStatus

public class TaskStatus extends Object
Represents the status of a task from the perspective of the coordinator. The task may be ongoing (isComplete() false) or it may be complete (isComplete() true). TaskStatus objects are immutable.
  • Field Details

    • MAX_ERROR_MSG_TRUNCATION_LIMIT

      public static final int MAX_ERROR_MSG_TRUNCATION_LIMIT
      See Also:
  • Constructor Details

  • Method Details

    • running

      public static TaskStatus running(String taskId)
    • success

      public static TaskStatus success(String taskId)
    • success

      @Deprecated public static TaskStatus success(String taskId, String errorMsg)
      Deprecated.
      The succeeded task status should not have error messages. Use success(String) instead.
    • failure

      public static TaskStatus failure(String taskId, String errorMsg)
      All failed task status must have a non-null error message.
    • success

      public static TaskStatus success(String taskId, TaskLocation location)
    • fromCode

      public static TaskStatus fromCode(String taskId, TaskState code)
      This method is deprecated for production because it does not handle the error message of failed task status properly. Use success(String) or failure(String, String) instead.
    • getId

      public String getId()
    • getStatusCode

      public TaskState getStatusCode()
    • getDuration

      public long getDuration()
    • getErrorMsg

      @Nullable public String getErrorMsg()
    • getLocation

      public TaskLocation getLocation()
    • isRunnable

      public boolean isRunnable()
      Signals that a task is not yet complete, and is still runnable on a worker. Exactly one of isRunnable, isSuccess, or isFailure will be true at any one time.
      Returns:
      whether the task is runnable.
    • isComplete

      public boolean isComplete()
      Inverse of isRunnable().
      Returns:
      whether the task is complete.
    • isSuccess

      public boolean isSuccess()
      Returned by tasks when they spawn subtasks. Exactly one of isRunnable, isSuccess, or isFailure will be true at any one time.
      Returns:
      whether the task succeeded.
    • isFailure

      public boolean isFailure()
      Returned by tasks when they complete unsuccessfully. Exactly one of isRunnable, isSuccess, or isFailure will be true at any one time.
      Returns:
      whether the task failed
    • withDuration

      public TaskStatus withDuration(long _duration)
    • withLocation

      public TaskStatus withLocation(TaskLocation location)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object