GeoWebCache/geowebcache — Issue #95: Fix inconsistent use of REST API to query and kill running tasks
Author: groldan
Created: 2012-01-27 04:48:13+00:00
State: open
Labels: Improvement

GWC draws a parallel between seed/truncate tasks and threads that execute those tasks as if they were the same thing.
This is because in 1.2.x that was the case, but since then the number of concurrently executing seed/truncate tasks was bound to a limited thread pool with 16 worker threads.

So when querying for the running tasks, an array sized by the number of threads in the thread pool is returned instead of an array of actually submitted tasks.

Also, it is not possible to query for the status of tasks for a specific layer, although it is mandatory to include the name of an existing layer in the query string; /rest/seed/.json

When killing threads the same thing apply. It is not possible to target one specific layers. Is is only possible to kill all the running tasks for all the layers, although it is required that the name of an existing layer is included: /rest/seed/.

Make it so that:
- querying for the status of seed/truncate tasks returns an array sized by the actual number of submitted tasks instead of the thread pool capacity
- querying to /rest/seed.json returns the array of task status for all the layers, but querying to /rest/seed/.json returns only the submitted tasks for that specific layer.
- the returned array contains both running and pending tasks, with two extra bits of information: the task id and the status (pending, running, finished, or aborted).
- posting to /rest/seed/ with the kill_all form parameter only kills tasks for that specific layer instead of for all layers
- posting to /rest/seed with the kill_all form parameter kills tasks for all layers
- it is possible to specify whether to kill only the running tasks (current behavior), pending tasks, or both running and pending.