Class PersistentTasksClusterService

    • Field Detail

      • CLUSTER_TASKS_ALLOCATION_RECHECK_INTERVAL_SETTING

        public static final Setting<TimeValue> CLUSTER_TASKS_ALLOCATION_RECHECK_INTERVAL_SETTING
    • Method Detail

      • setRecheckInterval

        public void setRecheckInterval​(TimeValue recheckInterval)
      • completePersistentTask

        public void completePersistentTask​(String id,
                                           long allocationId,
                                           Exception failure,
                                           ActionListener<PersistentTasksCustomMetaData.PersistentTask<?>> listener)
        Restarts a record about a running persistent task from cluster state
        Parameters:
        id - the id of the persistent task
        allocationId - the allocation id of the persistent task
        failure - the reason for restarting the task or null if the task completed successfully
        listener - the listener that will be called when task is removed
      • updatePersistentTaskState

        public void updatePersistentTaskState​(String taskId,
                                              long taskAllocationId,
                                              PersistentTaskState taskState,
                                              ActionListener<PersistentTasksCustomMetaData.PersistentTask<?>> listener)
        Update the state of a persistent task
        Parameters:
        taskId - the id of a persistent task
        taskAllocationId - the expected allocation id of the persistent task
        taskState - new state
        listener - the listener that will be called when task is removed
      • unassignPersistentTask

        public void unassignPersistentTask​(String taskId,
                                           long taskAllocationId,
                                           String reason,
                                           ActionListener<PersistentTasksCustomMetaData.PersistentTask<?>> listener)
        This unassigns a task from any node, i.e. it is assigned to a null node with the provided reason. Since the assignment executor node is null, the PersistentTasksClusterService will attempt to reassign it to a valid node quickly.
        Parameters:
        taskId - the id of a persistent task
        taskAllocationId - the expected allocation id of the persistent task
        reason - the reason for unassigning the task from any node
        listener - the listener that will be called when task is unassigned