mirror of https://github.com/apache/druid.git
'shutdownAllTasks' API for a dataSource (#6185)
* 'shutdownAllTasks' API for a dataSource Change-Id: I30d14390457d39e0427d23a48f4f224223dc5777 * fix api path and return Change-Id: Ib463f31ee2c4cb168cf2697f149be845b57c42e5 * optimize implementation Change-Id: I50a8dcd44dd9d36c9ecbfa78e103eb9bff32eab9
This commit is contained in:
parent
1c8032f9f3
commit
b0cf8d0252
|
@ -378,6 +378,9 @@ Endpoint for submitting tasks and supervisor specs to the overlord. Returns the
|
||||||
|
|
||||||
Shuts down a task.
|
Shuts down a task.
|
||||||
|
|
||||||
|
* `druid/indexer/v1/task/{dataSource}/shutdownAllTasks`
|
||||||
|
|
||||||
|
Shuts down all tasks for a dataSource.
|
||||||
|
|
||||||
## MiddleManager
|
## MiddleManager
|
||||||
|
|
||||||
|
|
|
@ -337,6 +337,28 @@ public class OverlordResource
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@POST
|
||||||
|
@Path("/task/{dataSource}/shutdownAllTasks")
|
||||||
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
public Response shutdownTasksForDataSource(@PathParam("dataSource") final String dataSource)
|
||||||
|
{
|
||||||
|
return asLeaderWith(
|
||||||
|
taskMaster.getTaskQueue(),
|
||||||
|
new Function<TaskQueue, Response>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public Response apply(TaskQueue taskQueue)
|
||||||
|
{
|
||||||
|
final List<TaskInfo<Task, TaskStatus>> tasks = taskStorageQueryAdapter.getActiveTaskInfo(dataSource);
|
||||||
|
for (final TaskInfo<Task, TaskStatus> task : tasks) {
|
||||||
|
taskQueue.shutdown(task.getId());
|
||||||
|
}
|
||||||
|
return Response.ok(ImmutableMap.of("dataSource", dataSource)).build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Path("/taskStatus")
|
@Path("/taskStatus")
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
|
Loading…
Reference in New Issue