Package org.apache.drill.yarn.appMaster
Class TaskState
java.lang.Object
org.apache.drill.yarn.appMaster.TaskState
- Direct Known Subclasses:
TaskState.EndingState
,TaskState.KillingState
Represents the behaviors associated with each state in the lifecycle
of a task.
RUNNING --> WAIT_END_ACK | END
The resource manager reported task completion.
RUNNING --> ENDING
Request sent to the task for a graceful shutdown.
RUNNING --> KILLING
Request sent to the node manager to forcibly kill the task.
ENDING --> WAIT_END_ACK | END
The task gracefully exited as reported by the resource manager.
ENDING --> KILLING
The wait for graceful exit timed out, a forced kill message
sent to the node manager.
KILLING --> WAIT_END_ACK | END
The task exited as reported by the resource manager.
END_ACK --> END
The end-ack is received or the wait timed out.
Startup process:
- START --> REQUESTING
- New task sends a container request to YARN.
- REQUESTING --> LAUNCHING
- Container received from YARN, launching the tasks's process.
- LAUNCHING --> RUNNING
- Task launched and needs no start Ack.
- LAUNCHING --> WAIT_START_ACK
- Task launched and needs a start Ack.
- WAIT_START_ACK --> RUNNING
- Start Ack received.
Shutdown process:
This is a do-it-yourself enum. Java enums values are instances of a single class. In this version, each enum value is the sole instance of a separate class, allowing each state to have its own behavior.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Task for which a termination request has been sent to the Drill-bit, but confirmation has not yet been received from the Node Manager.static class
Task for which a forced termination request has been sent to the Node Manager, but a stop message has not yet been received. -
Field Summary
Modifier and TypeFieldDescriptionprotected final boolean
static final TaskState
static final TaskState
protected final boolean
static final TaskState
protected final String
static final TaskState
protected final TaskLifecycleListener.Event
static final TaskState
static final TaskState
static final TaskState
static final TaskState
static final TaskState
-
Constructor Summary
ConstructorDescriptionTaskState
(boolean hasContainer, TaskLifecycleListener.Event lcEvent, boolean cancellable) -
Method Summary
Modifier and TypeMethodDescriptionvoid
cancel
(EventContext context) Cluster manager wishes to cancel this task.protected void
completed
(EventContext context, org.apache.hadoop.yarn.api.records.ContainerStatus status) void
completionAck
(EventContext context) The monitoring plugin has detected that the task has confirmed that it has started shutdown.void
containerAllocated
(EventContext context, org.apache.hadoop.yarn.api.records.Container container) Resource Manager reports that the task has been allocated a container.void
containerCompleted
(EventContext context, org.apache.hadoop.yarn.api.records.ContainerStatus status) Resource Manager reports that the task has completed execution and provided the completion status.void
containerStarted
(EventContext context) Node Manager reports that the task has started execution.void
containerStopped
(EventContext context) Node Manager reports that the task has stopped execution.protected void
endOrAck
(EventContext context) getLabel()
boolean
boolean
void
launchFailed
(EventContext context, Throwable t) The launch of the container failed.void
requestContainer
(EventContext context) void
startAck
(EventContext context) The monitoring plugin has detected that the task has confirmed that it is fully started.void
stopTaskFailed
(EventContext context, Throwable t) The node manager request to stop a task failed.protected void
taskStartFailed
(EventContext context, Task.Disposition disposition) Task failed when starting.protected void
taskTerminated
(EventContext context) A running task terminated.void
tick
(EventContext context, long curTime) toString()
protected void
transition
(EventContext context, TaskState newState) Implement a state transition, alerting any life cycle listeners and updating the log file.
-
Field Details
-
START
-
REQUESTING
-
LAUNCHING
-
WAIT_START_ACK
-
RUNNING
-
ENDING
-
KILLING
-
WAIT_END_ACK
-
END
-
hasContainer
protected final boolean hasContainer -
lifeCycleEvent
-
label
-
cancellable
protected final boolean cancellable
-
-
Constructor Details
-
TaskState
-
-
Method Details
-
endOrAck
-
requestContainer
-
containerAllocated
public void containerAllocated(EventContext context, org.apache.hadoop.yarn.api.records.Container container) Resource Manager reports that the task has been allocated a container.- Parameters:
context
-container
-
-
launchFailed
The launch of the container failed.- Parameters:
context
-t
-
-
containerStarted
Node Manager reports that the task has started execution.- Parameters:
context
-
-
startAck
The monitoring plugin has detected that the task has confirmed that it is fully started. -
stopTaskFailed
The node manager request to stop a task failed.- Parameters:
context
-t
-
-
completionAck
The monitoring plugin has detected that the task has confirmed that it has started shutdown. -
containerStopped
Node Manager reports that the task has stopped execution. We don't yet know if this was a success or failure.- Parameters:
context
-
-
containerCompleted
public void containerCompleted(EventContext context, org.apache.hadoop.yarn.api.records.ContainerStatus status) Resource Manager reports that the task has completed execution and provided the completion status.- Parameters:
context
-status
-
-
cancel
Cluster manager wishes to cancel this task.- Parameters:
context
-
-
tick
-
transition
Implement a state transition, alerting any life cycle listeners and updating the log file. Marks the start time of the new state in support of states that implement a timeout.- Parameters:
context
-newState
-
-
taskStartFailed
Task failed when starting. No container has been allocated. The task will go from:
* --> ENDIf the run failed, and the task can be retried, it may then move from
END --> STARTING- Parameters:
context
-disposition
-
-
taskTerminated
A running task terminated. It may have succeeded or failed, this method will determine which.Every task goes from:
* --> ENDIf the run failed, and the task can be retried, it may then move from
END --> STARTING- Parameters:
context
-
-
completed
protected void completed(EventContext context, org.apache.hadoop.yarn.api.records.ContainerStatus status) -
toString
-
hasContainer
public boolean hasContainer() -
getLabel
-
isCancellable
public boolean isCancellable()
-