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 intMAX_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 booleanequals(Object o)static TaskStatusfailure(String taskId, String errorMsg)All failed task status must have a non-null error message.static TaskStatusfromCode(String taskId, TaskState code)This method is deprecated for production because it does not handle the error message of failed task status properly.longgetDuration()StringgetErrorMsg()StringgetId()TaskLocationgetLocation()TaskStategetStatusCode()inthashCode()booleanisComplete()Inverse ofisRunnable().booleanisFailure()Returned by tasks when they complete unsuccessfully.booleanisRunnable()Signals that a task is not yet complete, and is still runnable on a worker.booleanisSuccess()Returned by tasks when they spawn subtasks.static TaskStatusrunning(String taskId)static TaskStatussuccess(String taskId)static TaskStatussuccess(String taskId, String errorMsg)Deprecated.static TaskStatussuccess(String taskId, TaskLocation location)StringtoString()TaskStatuswithDuration(long _duration)TaskStatuswithLocation(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)
-
-