Package org.apache.druid.indexer
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 Summary
Fields Modifier and Type Field Description static int
MAX_ERROR_MSG_LENGTH
-
Constructor Summary
Constructors Constructor Description TaskStatus(String id, TaskState status, long duration, String errorMsg, TaskLocation location)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
equals(Object o)
static TaskStatus
failure(String taskId, String errorMsg)
All failed task status must have a non-null error message.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.long
getDuration()
String
getErrorMsg()
String
getId()
TaskLocation
getLocation()
TaskState
getStatusCode()
int
hashCode()
boolean
isComplete()
Inverse ofisRunnable()
.boolean
isFailure()
Returned by tasks when they complete unsuccessfully.boolean
isRunnable()
Signals that a task is not yet complete, and is still runnable on a worker.boolean
isSuccess()
Returned by tasks when they spawn subtasks.static TaskStatus
running(String taskId)
static TaskStatus
success(String taskId)
static TaskStatus
success(String taskId, String errorMsg)
Deprecated.static TaskStatus
success(String taskId, TaskLocation location)
String
toString()
TaskStatus
withDuration(long _duration)
TaskStatus
withLocation(TaskLocation location)
-
-
-
Field Detail
-
MAX_ERROR_MSG_LENGTH
public static final int MAX_ERROR_MSG_LENGTH
- See Also:
- Constant Field Values
-
-
Method Detail
-
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. Usesuccess(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. Usesuccess(String)
orfailure(String, String)
instead.
-
getId
public String getId()
-
getStatusCode
public TaskState getStatusCode()
-
getDuration
public long getDuration()
-
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 ofisRunnable()
.- 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)
-
-