Implementation:Apache Druid TasksView
| Knowledge Sources | |
|---|---|
| Domains | Web Console, Task Management |
| Last Updated | 2026-02-10 10:00 GMT |
Overview
Renders the Tasks management view in the Apache Druid web console, displaying a table of all ingestion tasks with their status, duration, and management actions.
Description
The TasksView is a React class component extending PureComponent that queries sys.tasks (or the Overlord API in no-SQL mode) to display all ingestion tasks. It shows task ID, group ID, type, datasource, status, error messages, creation time, duration, and location. Tasks are color-coded by status (running, waiting, pending, success, failed, canceled) and sorted by status priority then creation time. The view supports grouping by group ID, type, datasource, or status, and provides actions to kill running tasks, view task specs, open execution details, and navigate to related views.
Usage
Rendered as the main content area when the user navigates to the "Tasks" tab in the web console. Requires SQL or Overlord access capability.
Code Reference
Source Location
- Repository: Apache Druid
- File: web-console/src/views/tasks-view/tasks-view.tsx
- Lines: 1-730
Signature
export interface TasksViewProps {
filters: TableFilters;
onFiltersChange(filters: TableFilters): void;
openTaskDialog: boolean | undefined;
goToView(tab: ConsoleViewId, filters?: TableFilters): void;
goToQuery(queryWithContext: QueryWithContext): void;
goToClassicBatchDataLoader(taskId?: string): void;
capabilities: Capabilities;
}
export interface TasksViewState {
tasksState: QueryState<TaskQueryResultRow[]>;
groupTasksBy?: 'group_id' | 'type' | 'datasource' | 'status';
killTaskId?: string;
taskSpecDialogOpen: boolean;
alertErrorMsg?: string;
taskTableActionDialogOpen?: { id: string; status: string; actions: BasicAction[] };
executionDialogOpen?: string;
visibleColumns: LocalStorageBackedVisibility;
}
export class TasksView extends React.PureComponent<TasksViewProps, TasksViewState>
Import
import { TasksView } from '../../views/tasks-view/tasks-view';
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| filters | TableFilters |
Yes | Current table filter state for filtering the tasks table. |
| onFiltersChange | (filters: TableFilters) => void |
Yes | Callback invoked when the user changes table filters. |
| openTaskDialog | undefined | No | If true, opens the task submission dialog on mount. |
| goToView | (tab: ConsoleViewId, filters?: TableFilters) => void |
Yes | Callback to navigate to another console view. |
| goToQuery | (queryWithContext: QueryWithContext) => void |
Yes | Callback to navigate to the Query view with a pre-populated query. |
| goToClassicBatchDataLoader | (taskId?: string) => void |
Yes | Callback to navigate to the classic batch data loader, optionally with a task ID. |
| capabilities | Capabilities |
Yes | The detected cluster capabilities. |
Outputs
| Name | Type | Description |
|---|---|---|
| JSX.Element | React element | Renders the complete tasks view including control bar, ReactTable with optional grouping, task spec dialog, kill confirmation dialog, alert dialog, task action dialog, and execution details dialog. |
Usage Examples
Rendering the Tasks View
<TasksView
filters={taskFilters}
onFiltersChange={setTaskFilters}
openTaskDialog={false}
goToView={handleGoToView}
goToQuery={handleGoToQuery}
goToClassicBatchDataLoader={handleGoToClassicBatch}
capabilities={capabilities}
/>
Internals
Table Columns
| Column | Description |
|---|---|
| Task ID | Unique task identifier, clickable for detail view |
| Group ID | Grouping identifier for related tasks |
| Type | Task type (e.g., index_parallel, compact, kill, index_kafka) |
| Datasource | Target datasource for the task |
| Status | Color-coded status (RUNNING, WAITING, PENDING, SUCCESS, FAILED, CANCELED) |
| Error | Error message for failed tasks (hidden by default) |
| Created time | When the task was created |
| Duration | How long the task has been running or ran |
| Location | Where the task is executing |
Status Colors
| Status | Color | Ranking |
|---|---|---|
| RUNNING | Blue (#2167d5) | 4 (highest) |
| PENDING | Yellow (#ffbf00) | 3 |
| WAITING | Orange (#d5631a) | 2 |
| SUCCESS | Green (#57d500) | 1 |
| FAILED | Red (#d5100a) | 1 |
| CANCELED | Gray (#858585) | (unranked) |
SQL Query
WITH tasks AS (
SELECT
"task_id", "group_id", "type", "datasource",
"created_time", "location", "duration", "error_msg",
CASE
WHEN <canceled_predicate> THEN 'CANCELED'
WHEN "status" = 'RUNNING' THEN "runner_status"
ELSE "status"
END AS "status"
FROM sys.tasks
)
SELECT * FROM tasks
ORDER BY (CASE "status" WHEN 'RUNNING' THEN 4 ... END) DESC, "created_time" DESC
Canceled Task Detection
Tasks are marked as CANCELED when their error message matches one of the predefined TASK_CANCELED_ERROR_MESSAGES from the druid-models module (using TASK_CANCELED_PREDICATE in SQL).
Dialogs
SpecDialog-- Submit a new task by providing a JSON task specAsyncActionDialog-- Confirm and execute task cancellation (kill)AlertDialog-- Display task error messagesTaskTableActionDialog-- Show task details with contextual actionsExecutionDetailsDialog-- Show MSQ execution details for applicable tasks
Grouping Options
Tasks can be grouped by:
- group_id -- Groups related sub-tasks together
- type -- Groups by task type
- datasource -- Groups by target datasource
- status -- Groups by current status