Class DeletionTask
java.lang.Object
org.apache.hadoop.yarn.server.nodemanager.containermanager.deletion.task.DeletionTask
- All Implemented Interfaces:
Runnable
- Direct Known Subclasses:
DockerContainerDeletionTask,FileDeletionTask
DeletionTasks are supplied to the
DeletionService for deletion.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDeletionTask(int taskId, DeletionService deletionService, String user, AtomicInteger numberOfPendingPredecessorTasks, Set<DeletionTask> successorTaskSet, DeletionTaskType deletionTaskType) Deletion task with taskId and user supplied values.DeletionTask(int taskId, DeletionService deletionService, String user, DeletionTaskType deletionTaskType) Deletion task with taskId and default values. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDeletionTaskDependency(DeletionTask successorTask) Add a dependent DeletionTask.abstract org.apache.hadoop.yarn.proto.YarnServerNodemanagerRecoveryProtos.DeletionServiceDeleteTaskProtoConvert the DeletionTask to the Protobuf representation for storing in the state store and recovery.intDecrements and returns pending predecessor task count.Get theDeletionServicefor this DeletionTask.Get theDeletionTaskTypefor this DeletionTask.Return the list of successor tasks for the DeletionTask.booleanReturn the DeletionTask run status.intGet the taskId for the DeletionTask.getUser()The the user assoicated with the DeletionTask.intIncrements and returns pending predecessor task count.voidsetSuccess(boolean success) Set the DeletionTask run status.voidsetTaskId(int taskId) Set the taskId for the DeletionTask.
-
Field Details
-
INVALID_TASK_ID
public static final int INVALID_TASK_ID- See Also:
-
-
Constructor Details
-
DeletionTask
public DeletionTask(int taskId, DeletionService deletionService, String user, DeletionTaskType deletionTaskType) Deletion task with taskId and default values.- Parameters:
taskId- the ID of the task, if previously set.deletionService- theDeletionService.user- the user associated with the delete.deletionTaskType- theDeletionTaskType.
-
DeletionTask
public DeletionTask(int taskId, DeletionService deletionService, String user, AtomicInteger numberOfPendingPredecessorTasks, Set<DeletionTask> successorTaskSet, DeletionTaskType deletionTaskType) Deletion task with taskId and user supplied values.- Parameters:
taskId- the ID of the task, if previously set.deletionService- theDeletionService.user- the user associated with the delete.numberOfPendingPredecessorTasks- Number of pending tasks.successorTaskSet- the list of successor DeletionTasksdeletionTaskType- theDeletionTaskType.
-
-
Method Details
-
getTaskId
public int getTaskId()Get the taskId for the DeletionTask.- Returns:
- the taskId.
-
setTaskId
public void setTaskId(int taskId) Set the taskId for the DeletionTask.- Parameters:
taskId- the taskId.
-
getUser
The the user assoicated with the DeletionTask.- Returns:
- the user name.
-
getDeletionService
Get theDeletionServicefor this DeletionTask.- Returns:
- the
DeletionService.
-
getDeletionTaskType
Get theDeletionTaskTypefor this DeletionTask.- Returns:
- the
DeletionTaskType.
-
setSuccess
public void setSuccess(boolean success) Set the DeletionTask run status.- Parameters:
success- the status of the running DeletionTask.
-
getSucess
public boolean getSucess()Return the DeletionTask run status.- Returns:
- the status of the running DeletionTask.
-
getSuccessorTasks
Return the list of successor tasks for the DeletionTask.- Returns:
- the list of successor tasks.
-
convertDeletionTaskToProto
public abstract org.apache.hadoop.yarn.proto.YarnServerNodemanagerRecoveryProtos.DeletionServiceDeleteTaskProto convertDeletionTaskToProto()Convert the DeletionTask to the Protobuf representation for storing in the state store and recovery.- Returns:
- the protobuf representation of the DeletionTask.
-
addDeletionTaskDependency
Add a dependent DeletionTask. If there is a task dependency between say tasks 1,2,3 such that task2 and task3 can be started only after task1 then we should define task2 and task3 as successor tasks for task1. Note:- Task dependency should be defined prior to calling delete.- Parameters:
successorTask- the DeletionTask the depends on this DeletionTask.
-
incrementAndGetPendingPredecessorTasks
public int incrementAndGetPendingPredecessorTasks()Increments and returns pending predecessor task count.- Returns:
- the number of pending predecessor DeletionTasks.
-
decrementAndGetPendingPredecessorTasks
public int decrementAndGetPendingPredecessorTasks()Decrements and returns pending predecessor task count.- Returns:
- the number of pending predecessor DeletionTasks.
-