@@ -65,6 +65,21 @@ public <Params extends PersistentTaskParams> void sendStartRequest(
6565 sendStartRequest (null , taskId , taskName , taskParams , timeout , listener );
6666 }
6767
68+ /**
69+ * Notifies the master node to create new cluster persistent task and to assign it to a node.
70+ * Accepts operation timeout as optional parameter
71+ */
72+ public <Params extends PersistentTaskParams > void sendClusterStartRequest (
73+ final String taskId ,
74+ final String taskName ,
75+ final Params taskParams ,
76+ final TimeValue timeout ,
77+ final ActionListener <PersistentTask <Params >> listener
78+ ) {
79+ assert PersistentTasksExecutorRegistry .isClusterScopedTask (taskName ) : taskName + " is not a cluster scoped task" ;
80+ sendStartRequest (null , taskId , taskName , taskParams , timeout , listener );
81+ }
82+
6883 /**
6984 * Notifies the master node to create new project level persistent task and to assign it to a node.
7085 * Accepts operation timeout as optional parameter
@@ -118,6 +133,25 @@ public void sendCompletionRequest(
118133 sendCompletionRequest (null , taskId , taskAllocationId , taskFailure , localAbortReason , timeout , listener );
119134 }
120135
136+ /**
137+ * Notifies the master node about the completion of a persistent task.
138+ * <p>
139+ * At most one of {@code failure} and {@code localAbortReason} may be
140+ * provided. When both {@code failure} and {@code localAbortReason} are
141+ * {@code null}, the persistent task is considered as successfully completed.
142+ * Accepts operation timeout as optional parameter
143+ */
144+ public void sendClusterCompletionRequest (
145+ final String taskId ,
146+ final long taskAllocationId ,
147+ final @ Nullable Exception taskFailure ,
148+ final @ Nullable String localAbortReason ,
149+ final @ Nullable TimeValue timeout ,
150+ final ActionListener <PersistentTask <?>> listener
151+ ) {
152+ sendCompletionRequest (null , taskId , taskAllocationId , taskFailure , localAbortReason , timeout , listener );
153+ }
154+
121155 /**
122156 * Notifies the master node about the completion of a project level persistent task.
123157 * <p>
@@ -176,6 +210,13 @@ void sendCancelRequest(final long taskId, final String reason, final ActionListe
176210 sendCancelRequest (null , taskId , reason , listener );
177211 }
178212
213+ /**
214+ * Cancels a locally running task using the Task Manager API. Accepts operation timeout as optional parameter
215+ */
216+ void sendClusterCancelRequest (final long taskId , final String reason , final ActionListener <ListTasksResponse > listener ) {
217+ sendCancelRequest (null , taskId , reason , listener );
218+ }
219+
179220 /**
180221 * Cancels a locally running project task using the Task Manager API. Accepts operation timeout as optional parameter
181222 */
@@ -222,6 +263,23 @@ void sendUpdateStateRequest(
222263 sendUpdateStateRequest (null , taskId , taskAllocationID , taskState , timeout , listener );
223264 }
224265
266+ /**
267+ * Notifies the master node that the state of a persistent task has changed.
268+ * <p>
269+ * Persistent task implementers shouldn't call this method directly and use
270+ * {@link AllocatedPersistentTask#updatePersistentTaskState} instead.
271+ * Accepts operation timeout as optional parameter
272+ */
273+ void sendClusterUpdateStateRequest (
274+ final String taskId ,
275+ final long taskAllocationID ,
276+ final PersistentTaskState taskState ,
277+ final TimeValue timeout ,
278+ final ActionListener <PersistentTask <?>> listener
279+ ) {
280+ sendUpdateStateRequest (null , taskId , taskAllocationID , taskState , timeout , listener );
281+ }
282+
225283 /**
226284 * Notifies the master node that the state of a project level persistent task has changed.
227285 * <p>
@@ -263,6 +321,13 @@ public void sendRemoveRequest(final String taskId, final TimeValue timeout, fina
263321 sendRemoveRequest (null , taskId , timeout , listener );
264322 }
265323
324+ /**
325+ * Notifies the master node to remove a persistent task from the cluster state. Accepts operation timeout as optional parameter
326+ */
327+ public void sendClusterRemoveRequest (final String taskId , final TimeValue timeout , final ActionListener <PersistentTask <?>> listener ) {
328+ sendRemoveRequest (null , taskId , timeout , listener );
329+ }
330+
266331 /**
267332 * Notifies the master node to remove a project level persistent task from the cluster state.
268333 * Accepts operation timeout as optional parameter
0 commit comments