gianm closed pull request #6185: 'shutdownAllTasks' API for a dataSource
URL: https://github.com/apache/incubator-druid/pull/6185
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/docs/content/operations/api-reference.md
b/docs/content/operations/api-reference.md
index d933c4f4052..a38be3b0696 100644
--- a/docs/content/operations/api-reference.md
+++ b/docs/content/operations/api-reference.md
@@ -378,6 +378,9 @@ Endpoint for submitting tasks and supervisor specs to the
overlord. Returns the
Shuts down a task.
+* `druid/indexer/v1/task/{dataSource}/shutdownAllTasks`
+
+Shuts down all tasks for a dataSource.
## MiddleManager
diff --git
a/indexing-service/src/main/java/io/druid/indexing/overlord/http/OverlordResource.java
b/indexing-service/src/main/java/io/druid/indexing/overlord/http/OverlordResource.java
index 6eb428c4649..3425a87b35a 100644
---
a/indexing-service/src/main/java/io/druid/indexing/overlord/http/OverlordResource.java
+++
b/indexing-service/src/main/java/io/druid/indexing/overlord/http/OverlordResource.java
@@ -337,6 +337,28 @@ public Response apply(TaskQueue taskQueue)
);
}
+ @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
@Path("/taskStatus")
@Produces(MediaType.APPLICATION_JSON)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]