java.lang.Object
org.apache.hadoop.yarn.server.nodemanager.containermanager.deletion.task.DeletionTask
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
DockerContainerDeletionTask, FileDeletionTask

public abstract class DeletionTask extends Object implements Runnable
DeletionTasks are supplied to the DeletionService for deletion.
  • Field Details

  • 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 - the DeletionService.
      user - the user associated with the delete.
      deletionTaskType - the DeletionTaskType.
    • 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 - the DeletionService.
      user - the user associated with the delete.
      numberOfPendingPredecessorTasks - Number of pending tasks.
      successorTaskSet - the list of successor DeletionTasks
      deletionTaskType - the DeletionTaskType.
  • 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

      public String getUser()
      The the user assoicated with the DeletionTask.
      Returns:
      the user name.
    • getDeletionService

      public DeletionService getDeletionService()
      Get the DeletionService for this DeletionTask.
      Returns:
      the DeletionService.
    • getDeletionTaskType

      public DeletionTaskType getDeletionTaskType()
      Get the DeletionTaskType for 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

      public 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

      public void addDeletionTaskDependency(DeletionTask successorTask)
      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.