Add kill functionality to scheduled and retry tasks table

This commit is contained in:
Ken Hibino 2020-12-19 07:38:23 -08:00
parent b387546fa8
commit a76cc5afa5
9 changed files with 651 additions and 8 deletions

View File

@ -3,6 +3,9 @@ import {
batchDeleteRetryTasks, batchDeleteRetryTasks,
batchDeleteScheduledTasks, batchDeleteScheduledTasks,
BatchDeleteTasksResponse, BatchDeleteTasksResponse,
batchKillRetryTasks,
batchKillScheduledTasks,
BatchKillTasksResponse,
batchRunDeadTasks, batchRunDeadTasks,
batchRunRetryTasks, batchRunRetryTasks,
batchRunScheduledTasks, batchRunScheduledTasks,
@ -14,6 +17,10 @@ import {
deleteDeadTask, deleteDeadTask,
deleteRetryTask, deleteRetryTask,
deleteScheduledTask, deleteScheduledTask,
killAllRetryTasks,
killAllScheduledTasks,
killRetryTask,
killScheduledTask,
listActiveTasks, listActiveTasks,
ListActiveTasksResponse, ListActiveTasksResponse,
listDeadTasks, listDeadTasks,
@ -65,12 +72,24 @@ export const RUN_DEAD_TASK_ERROR = "RUN_DEAD_TASK_ERROR";
export const DELETE_SCHEDULED_TASK_BEGIN = "DELETE_SCHEDULED_TASK_BEGIN"; export const DELETE_SCHEDULED_TASK_BEGIN = "DELETE_SCHEDULED_TASK_BEGIN";
export const DELETE_SCHEDULED_TASK_SUCCESS = "DELETE_SCHEDULED_TASK_SUCCESS"; export const DELETE_SCHEDULED_TASK_SUCCESS = "DELETE_SCHEDULED_TASK_SUCCESS";
export const DELETE_SCHEDULED_TASK_ERROR = "DELETE_SCHEDULED_TASK_ERROR"; export const DELETE_SCHEDULED_TASK_ERROR = "DELETE_SCHEDULED_TASK_ERROR";
export const KILL_SCHEDULED_TASK_BEGIN = "KILL_DEAD_TASK_BEGIN";
export const KILL_SCHEDULED_TASK_SUCCESS = "KILL_DEAD_TASK_SUCCESS";
export const KILL_SCHEDULED_TASK_ERROR = "KILL_DEAD_TASK_ERROR";
export const KILL_RETRY_TASK_BEGIN = "KILL_RETRY_TASK_BEGIN";
export const KILL_RETRY_TASK_SUCCESS = "KILL_RETRY_TASK_SUCCESS";
export const KILL_RETRY_TASK_ERROR = "KILL_RETRY_TASK_ERROR";
export const BATCH_RUN_SCHEDULED_TASKS_BEGIN = export const BATCH_RUN_SCHEDULED_TASKS_BEGIN =
"BATCH_RUN_SCHEDULED_TASKS_BEGIN"; "BATCH_RUN_SCHEDULED_TASKS_BEGIN";
export const BATCH_RUN_SCHEDULED_TASKS_SUCCESS = export const BATCH_RUN_SCHEDULED_TASKS_SUCCESS =
"BATCH_RUN_SCHEDULED_TASKS_SUCCESS"; "BATCH_RUN_SCHEDULED_TASKS_SUCCESS";
export const BATCH_RUN_SCHEDULED_TASKS_ERROR = export const BATCH_RUN_SCHEDULED_TASKS_ERROR =
"BATCH_RUN_SCHEDULED_TASKS_ERROR"; "BATCH_RUN_SCHEDULED_TASKS_ERROR";
export const BATCH_KILL_SCHEDULED_TASKS_BEGIN =
"BATCH_KILL_SCHEDULED_TASKS_BEGIN";
export const BATCH_KILL_SCHEDULED_TASKS_SUCCESS =
"BATCH_KILL_SCHEDULED_TASKS_SUCCESS";
export const BATCH_KILL_SCHEDULED_TASKS_ERROR =
"BATCH_RUN_SCHEDULED_TASKS_ERROR";
export const BATCH_DELETE_SCHEDULED_TASKS_BEGIN = export const BATCH_DELETE_SCHEDULED_TASKS_BEGIN =
"BATCH_DELETE_SCHEDULED_TASKS_BEGIN"; "BATCH_DELETE_SCHEDULED_TASKS_BEGIN";
export const BATCH_DELETE_SCHEDULED_TASKS_SUCCESS = export const BATCH_DELETE_SCHEDULED_TASKS_SUCCESS =
@ -81,6 +100,10 @@ export const RUN_ALL_SCHEDULED_TASKS_BEGIN = "RUN_ALL_SCHEDULED_TASKS_BEGIN";
export const RUN_ALL_SCHEDULED_TASKS_SUCCESS = export const RUN_ALL_SCHEDULED_TASKS_SUCCESS =
"RUN_ALL_SCHEDULED_TASKS_SUCCESS"; "RUN_ALL_SCHEDULED_TASKS_SUCCESS";
export const RUN_ALL_SCHEDULED_TASKS_ERROR = "RUN_ALL_SCHEDULED_TASKS_ERROR"; export const RUN_ALL_SCHEDULED_TASKS_ERROR = "RUN_ALL_SCHEDULED_TASKS_ERROR";
export const KILL_ALL_SCHEDULED_TASKS_BEGIN = "KILL_ALL_SCHEDULED_TASKS_BEGIN";
export const KILL_ALL_SCHEDULED_TASKS_SUCCESS =
"KILL_ALL_SCHEDULED_TASKS_SUCCESS";
export const KILL_ALL_SCHEDULED_TASKS_ERROR = "KILL_ALL_SCHEDULED_TASKS_ERROR";
export const DELETE_ALL_SCHEDULED_TASKS_BEGIN = export const DELETE_ALL_SCHEDULED_TASKS_BEGIN =
"DELETE_ALL_SCHEDULED_TASKS_BEGIN"; "DELETE_ALL_SCHEDULED_TASKS_BEGIN";
export const DELETE_ALL_SCHEDULED_TASKS_SUCCESS = export const DELETE_ALL_SCHEDULED_TASKS_SUCCESS =
@ -93,6 +116,9 @@ export const DELETE_RETRY_TASK_ERROR = "DELETE_RETRY_TASK_ERROR";
export const BATCH_RUN_RETRY_TASKS_BEGIN = "BATCH_RUN_RETRY_TASKS_BEGIN"; export const BATCH_RUN_RETRY_TASKS_BEGIN = "BATCH_RUN_RETRY_TASKS_BEGIN";
export const BATCH_RUN_RETRY_TASKS_SUCCESS = "BATCH_RUN_RETRY_TASKS_SUCCESS"; export const BATCH_RUN_RETRY_TASKS_SUCCESS = "BATCH_RUN_RETRY_TASKS_SUCCESS";
export const BATCH_RUN_RETRY_TASKS_ERROR = "BATCH_RUN_RETRY_TASKS_ERROR"; export const BATCH_RUN_RETRY_TASKS_ERROR = "BATCH_RUN_RETRY_TASKS_ERROR";
export const BATCH_KILL_RETRY_TASKS_BEGIN = "BATCH_KILL_RETRY_TASKS_BEGIN";
export const BATCH_KILL_RETRY_TASKS_SUCCESS = "BATCH_KILL_RETRY_TASKS_SUCCESS";
export const BATCH_KILL_RETRY_TASKS_ERROR = "BATCH_KILL_RETRY_TASKS_ERROR";
export const BATCH_DELETE_RETRY_TASKS_BEGIN = "BATCH_DELETE_RETRY_TASKS_BEGIN"; export const BATCH_DELETE_RETRY_TASKS_BEGIN = "BATCH_DELETE_RETRY_TASKS_BEGIN";
export const BATCH_DELETE_RETRY_TASKS_SUCCESS = export const BATCH_DELETE_RETRY_TASKS_SUCCESS =
"BATCH_DELETE_RETRY_TASKS_SUCCESS"; "BATCH_DELETE_RETRY_TASKS_SUCCESS";
@ -100,6 +126,9 @@ export const BATCH_DELETE_RETRY_TASKS_ERROR = "BATCH_DELETE_RETRY_TASKS_ERROR";
export const RUN_ALL_RETRY_TASKS_BEGIN = "RUN_ALL_RETRY_TASKS_BEGIN"; export const RUN_ALL_RETRY_TASKS_BEGIN = "RUN_ALL_RETRY_TASKS_BEGIN";
export const RUN_ALL_RETRY_TASKS_SUCCESS = "RUN_ALL_RETRY_TASKS_SUCCESS"; export const RUN_ALL_RETRY_TASKS_SUCCESS = "RUN_ALL_RETRY_TASKS_SUCCESS";
export const RUN_ALL_RETRY_TASKS_ERROR = "RUN_ALL_RETRY_TASKS_ERROR"; export const RUN_ALL_RETRY_TASKS_ERROR = "RUN_ALL_RETRY_TASKS_ERROR";
export const KILL_ALL_RETRY_TASKS_BEGIN = "KILL_ALL_RETRY_TASKS_BEGIN";
export const KILL_ALL_RETRY_TASKS_SUCCESS = "KILL_ALL_RETRY_TASKS_SUCCESS";
export const KILL_ALL_RETRY_TASKS_ERROR = "KILL_ALL_RETRY_TASKS_ERROR";
export const DELETE_ALL_RETRY_TASKS_BEGIN = "DELETE_ALL_RETRY_TASKS_BEGIN"; export const DELETE_ALL_RETRY_TASKS_BEGIN = "DELETE_ALL_RETRY_TASKS_BEGIN";
export const DELETE_ALL_RETRY_TASKS_SUCCESS = "DELETE_ALL_RETRY_TASKS_SUCCESS"; export const DELETE_ALL_RETRY_TASKS_SUCCESS = "DELETE_ALL_RETRY_TASKS_SUCCESS";
export const DELETE_ALL_RETRY_TASKS_ERROR = "DELETE_ALL_RETRY_TASKS_ERROR"; export const DELETE_ALL_RETRY_TASKS_ERROR = "DELETE_ALL_RETRY_TASKS_ERROR";
@ -223,6 +252,7 @@ interface CancelActiveTaskErrorAction {
taskId: string; taskId: string;
error: string; error: string;
} }
interface RunScheduledTaskBeginAction { interface RunScheduledTaskBeginAction {
type: typeof RUN_SCHEDULED_TASK_BEGIN; type: typeof RUN_SCHEDULED_TASK_BEGIN;
queue: string; queue: string;
@ -242,6 +272,25 @@ interface RunScheduledTaskErrorAction {
error: string; error: string;
} }
interface KillScheduledTaskBeginAction {
type: typeof KILL_SCHEDULED_TASK_BEGIN;
queue: string;
taskKey: string;
}
interface KillScheduledTaskSuccessAction {
type: typeof KILL_SCHEDULED_TASK_SUCCESS;
queue: string;
taskKey: string;
}
interface KillScheduledTaskErrorAction {
type: typeof KILL_SCHEDULED_TASK_ERROR;
queue: string;
taskKey: string;
error: string;
}
interface RunRetryTaskBeginAction { interface RunRetryTaskBeginAction {
type: typeof RUN_RETRY_TASK_BEGIN; type: typeof RUN_RETRY_TASK_BEGIN;
queue: string; queue: string;
@ -261,6 +310,25 @@ interface RunRetryTaskErrorAction {
error: string; error: string;
} }
interface KillRetryTaskBeginAction {
type: typeof KILL_RETRY_TASK_BEGIN;
queue: string;
taskKey: string;
}
interface KillRetryTaskSuccessAction {
type: typeof KILL_RETRY_TASK_SUCCESS;
queue: string;
taskKey: string;
}
interface KillRetryTaskErrorAction {
type: typeof KILL_RETRY_TASK_ERROR;
queue: string;
taskKey: string;
error: string;
}
interface RunDeadTaskBeginAction { interface RunDeadTaskBeginAction {
type: typeof RUN_DEAD_TASK_BEGIN; type: typeof RUN_DEAD_TASK_BEGIN;
queue: string; queue: string;
@ -353,6 +421,41 @@ interface RunAllScheduledTasksErrorAction {
error: string; error: string;
} }
interface BatchKillScheduledTasksBeginAction {
type: typeof BATCH_KILL_SCHEDULED_TASKS_BEGIN;
queue: string;
taskKeys: string[];
}
interface BatchKillScheduledTasksSuccessAction {
type: typeof BATCH_KILL_SCHEDULED_TASKS_SUCCESS;
queue: string;
payload: BatchKillTasksResponse;
}
interface BatchKillScheduledTasksErrorAction {
type: typeof BATCH_KILL_SCHEDULED_TASKS_ERROR;
queue: string;
taskKeys: string[];
error: string;
}
interface KillAllScheduledTasksBeginAction {
type: typeof KILL_ALL_SCHEDULED_TASKS_BEGIN;
queue: string;
}
interface KillAllScheduledTasksSuccessAction {
type: typeof KILL_ALL_SCHEDULED_TASKS_SUCCESS;
queue: string;
}
interface KillAllScheduledTasksErrorAction {
type: typeof KILL_ALL_SCHEDULED_TASKS_ERROR;
queue: string;
error: string;
}
interface DeleteAllScheduledTasksBeginAction { interface DeleteAllScheduledTasksBeginAction {
type: typeof DELETE_ALL_SCHEDULED_TASKS_BEGIN; type: typeof DELETE_ALL_SCHEDULED_TASKS_BEGIN;
queue: string; queue: string;
@ -442,6 +545,41 @@ interface RunAllRetryTasksErrorAction {
error: string; error: string;
} }
interface BatchKillRetryTasksBeginAction {
type: typeof BATCH_KILL_RETRY_TASKS_BEGIN;
queue: string;
taskKeys: string[];
}
interface BatchKillRetryTasksSuccessAction {
type: typeof BATCH_KILL_RETRY_TASKS_SUCCESS;
queue: string;
payload: BatchKillTasksResponse;
}
interface BatchKillRetryTasksErrorAction {
type: typeof BATCH_KILL_RETRY_TASKS_ERROR;
queue: string;
taskKeys: string[];
error: string;
}
interface KillAllRetryTasksBeginAction {
type: typeof KILL_ALL_RETRY_TASKS_BEGIN;
queue: string;
}
interface KillAllRetryTasksSuccessAction {
type: typeof KILL_ALL_RETRY_TASKS_SUCCESS;
queue: string;
}
interface KillAllRetryTasksErrorAction {
type: typeof KILL_ALL_RETRY_TASKS_ERROR;
queue: string;
error: string;
}
interface DeleteAllRetryTasksBeginAction { interface DeleteAllRetryTasksBeginAction {
type: typeof DELETE_ALL_RETRY_TASKS_BEGIN; type: typeof DELETE_ALL_RETRY_TASKS_BEGIN;
queue: string; queue: string;
@ -576,6 +714,12 @@ export type TasksActionTypes =
| RunDeadTaskBeginAction | RunDeadTaskBeginAction
| RunDeadTaskSuccessAction | RunDeadTaskSuccessAction
| RunDeadTaskErrorAction | RunDeadTaskErrorAction
| KillScheduledTaskBeginAction
| KillScheduledTaskSuccessAction
| KillScheduledTaskErrorAction
| KillRetryTaskBeginAction
| KillRetryTaskSuccessAction
| KillRetryTaskErrorAction
| DeleteScheduledTaskBeginAction | DeleteScheduledTaskBeginAction
| DeleteScheduledTaskSuccessAction | DeleteScheduledTaskSuccessAction
| DeleteScheduledTaskErrorAction | DeleteScheduledTaskErrorAction
@ -588,6 +732,12 @@ export type TasksActionTypes =
| RunAllScheduledTasksBeginAction | RunAllScheduledTasksBeginAction
| RunAllScheduledTasksSuccessAction | RunAllScheduledTasksSuccessAction
| RunAllScheduledTasksErrorAction | RunAllScheduledTasksErrorAction
| BatchKillScheduledTasksBeginAction
| BatchKillScheduledTasksSuccessAction
| BatchKillScheduledTasksErrorAction
| KillAllScheduledTasksBeginAction
| KillAllScheduledTasksSuccessAction
| KillAllScheduledTasksErrorAction
| DeleteAllScheduledTasksBeginAction | DeleteAllScheduledTasksBeginAction
| DeleteAllScheduledTasksSuccessAction | DeleteAllScheduledTasksSuccessAction
| DeleteAllScheduledTasksErrorAction | DeleteAllScheduledTasksErrorAction
@ -603,6 +753,12 @@ export type TasksActionTypes =
| RunAllRetryTasksBeginAction | RunAllRetryTasksBeginAction
| RunAllRetryTasksSuccessAction | RunAllRetryTasksSuccessAction
| RunAllRetryTasksErrorAction | RunAllRetryTasksErrorAction
| BatchKillRetryTasksBeginAction
| BatchKillRetryTasksSuccessAction
| BatchKillRetryTasksErrorAction
| KillAllRetryTasksBeginAction
| KillAllRetryTasksSuccessAction
| KillAllRetryTasksErrorAction
| DeleteAllRetryTasksBeginAction | DeleteAllRetryTasksBeginAction
| DeleteAllRetryTasksSuccessAction | DeleteAllRetryTasksSuccessAction
| DeleteAllRetryTasksErrorAction | DeleteAllRetryTasksErrorAction
@ -790,6 +946,42 @@ export function runRetryTaskAsync(queue: string, taskKey: string) {
}; };
} }
export function killScheduledTaskAsync(queue: string, taskKey: string) {
return async (dispatch: Dispatch<TasksActionTypes>) => {
dispatch({ type: KILL_SCHEDULED_TASK_BEGIN, queue, taskKey });
try {
await killScheduledTask(queue, taskKey);
dispatch({ type: KILL_SCHEDULED_TASK_SUCCESS, queue, taskKey });
} catch (error) {
console.error("killScheduledTaskAsync: ", error);
dispatch({
type: KILL_SCHEDULED_TASK_ERROR,
error: `Could not kill task: ${taskKey}`,
queue,
taskKey,
});
}
};
}
export function killRetryTaskAsync(queue: string, taskKey: string) {
return async (dispatch: Dispatch<TasksActionTypes>) => {
dispatch({ type: KILL_RETRY_TASK_BEGIN, queue, taskKey });
try {
await killRetryTask(queue, taskKey);
dispatch({ type: KILL_RETRY_TASK_SUCCESS, queue, taskKey });
} catch (error) {
console.error("killRetryTaskAsync: ", error);
dispatch({
type: KILL_RETRY_TASK_ERROR,
error: `Could not kill task: ${taskKey}`,
queue,
taskKey,
});
}
};
}
export function runDeadTaskAsync(queue: string, taskKey: string) { export function runDeadTaskAsync(queue: string, taskKey: string) {
return async (dispatch: Dispatch<TasksActionTypes>) => { return async (dispatch: Dispatch<TasksActionTypes>) => {
dispatch({ type: RUN_DEAD_TASK_BEGIN, queue, taskKey }); dispatch({ type: RUN_DEAD_TASK_BEGIN, queue, taskKey });
@ -873,6 +1065,31 @@ export function batchRunScheduledTasksAsync(queue: string, taskKeys: string[]) {
}; };
} }
export function batchKillScheduledTasksAsync(
queue: string,
taskKeys: string[]
) {
return async (dispatch: Dispatch<TasksActionTypes>) => {
dispatch({ type: BATCH_KILL_SCHEDULED_TASKS_BEGIN, queue, taskKeys });
try {
const response = await batchKillScheduledTasks(queue, taskKeys);
dispatch({
type: BATCH_KILL_SCHEDULED_TASKS_SUCCESS,
queue: queue,
payload: response,
});
} catch (error) {
console.error("batchKillScheduledTasksAsync: ", error);
dispatch({
type: BATCH_KILL_SCHEDULED_TASKS_ERROR,
error: `Could not batch kill tasks: ${taskKeys}`,
queue,
taskKeys,
});
}
};
}
export function deleteAllScheduledTasksAsync(queue: string) { export function deleteAllScheduledTasksAsync(queue: string) {
return async (dispatch: Dispatch<TasksActionTypes>) => { return async (dispatch: Dispatch<TasksActionTypes>) => {
dispatch({ type: DELETE_ALL_SCHEDULED_TASKS_BEGIN, queue }); dispatch({ type: DELETE_ALL_SCHEDULED_TASKS_BEGIN, queue });
@ -907,6 +1124,23 @@ export function runAllScheduledTasksAsync(queue: string) {
}; };
} }
export function killAllScheduledTasksAsync(queue: string) {
return async (dispatch: Dispatch<TasksActionTypes>) => {
dispatch({ type: RUN_ALL_SCHEDULED_TASKS_BEGIN, queue });
try {
await killAllScheduledTasks(queue);
dispatch({ type: RUN_ALL_SCHEDULED_TASKS_SUCCESS, queue });
} catch (error) {
console.error("killAllScheduledTasksAsync: ", error);
dispatch({
type: RUN_ALL_SCHEDULED_TASKS_ERROR,
error: `Could not kill all scheduled tasks`,
queue,
});
}
};
}
export function deleteRetryTaskAsync(queue: string, taskKey: string) { export function deleteRetryTaskAsync(queue: string, taskKey: string) {
return async (dispatch: Dispatch<TasksActionTypes>) => { return async (dispatch: Dispatch<TasksActionTypes>) => {
dispatch({ type: DELETE_RETRY_TASK_BEGIN, queue, taskKey }); dispatch({ type: DELETE_RETRY_TASK_BEGIN, queue, taskKey });
@ -969,6 +1203,28 @@ export function batchRunRetryTasksAsync(queue: string, taskKeys: string[]) {
}; };
} }
export function batchKillRetryTasksAsync(queue: string, taskKeys: string[]) {
return async (dispatch: Dispatch<TasksActionTypes>) => {
dispatch({ type: BATCH_KILL_RETRY_TASKS_BEGIN, queue, taskKeys });
try {
const response = await batchKillRetryTasks(queue, taskKeys);
dispatch({
type: BATCH_KILL_RETRY_TASKS_SUCCESS,
queue: queue,
payload: response,
});
} catch (error) {
console.error("batchKillRetryTasksAsync: ", error);
dispatch({
type: BATCH_KILL_RETRY_TASKS_ERROR,
error: `Could not batch kill tasks: ${taskKeys}`,
queue,
taskKeys,
});
}
};
}
export function deleteAllRetryTasksAsync(queue: string) { export function deleteAllRetryTasksAsync(queue: string) {
return async (dispatch: Dispatch<TasksActionTypes>) => { return async (dispatch: Dispatch<TasksActionTypes>) => {
dispatch({ type: DELETE_ALL_RETRY_TASKS_BEGIN, queue }); dispatch({ type: DELETE_ALL_RETRY_TASKS_BEGIN, queue });
@ -1003,6 +1259,23 @@ export function runAllRetryTasksAsync(queue: string) {
}; };
} }
export function killAllRetryTasksAsync(queue: string) {
return async (dispatch: Dispatch<TasksActionTypes>) => {
dispatch({ type: KILL_ALL_RETRY_TASKS_BEGIN, queue });
try {
await killAllRetryTasks(queue);
dispatch({ type: KILL_ALL_RETRY_TASKS_SUCCESS, queue });
} catch (error) {
console.error("killAllRetryTasksAsync: ", error);
dispatch({
type: KILL_ALL_RETRY_TASKS_ERROR,
error: `Could not kill all retry tasks`,
queue,
});
}
};
}
export function deleteDeadTaskAsync(queue: string, taskKey: string) { export function deleteDeadTaskAsync(queue: string, taskKey: string) {
return async (dispatch: Dispatch<TasksActionTypes>) => { return async (dispatch: Dispatch<TasksActionTypes>) => {
dispatch({ type: DELETE_DEAD_TASK_BEGIN, queue, taskKey }); dispatch({ type: DELETE_DEAD_TASK_BEGIN, queue, taskKey });

View File

@ -51,6 +51,11 @@ export interface BatchRunTasksResponse {
error_keys: string[]; error_keys: string[];
} }
export interface BatchKillTasksResponse {
dead_keys: string[];
error_keys: string[];
}
export interface Queue { export interface Queue {
queue: string; queue: string;
paused: boolean; paused: boolean;
@ -263,6 +268,16 @@ export async function runScheduledTask(
}); });
} }
export async function killScheduledTask(
qname: string,
taskKey: string
): Promise<void> {
await axios({
method: "post",
url: `${BASE_URL}/queues/${qname}/scheduled_tasks/${taskKey}:kill`,
});
}
export async function deleteScheduledTask( export async function deleteScheduledTask(
qname: string, qname: string,
taskKey: string taskKey: string
@ -315,6 +330,27 @@ export async function runAllScheduledTasks(qname: string): Promise<void> {
}); });
} }
export async function batchKillScheduledTasks(
qname: string,
taskKeys: string[]
): Promise<BatchKillTasksResponse> {
const resp = await axios({
method: "post",
url: `${BASE_URL}/queues/${qname}/scheduled_tasks:batch_kill`,
data: {
task_keys: taskKeys,
},
});
return resp.data;
}
export async function killAllScheduledTasks(qname: string): Promise<void> {
await axios({
method: "post",
url: `${BASE_URL}/queues/${qname}/scheduled_tasks:kill_all`,
});
}
export async function runRetryTask( export async function runRetryTask(
qname: string, qname: string,
taskKey: string taskKey: string
@ -325,6 +361,16 @@ export async function runRetryTask(
}); });
} }
export async function killRetryTask(
qname: string,
taskKey: string
): Promise<void> {
await axios({
method: "post",
url: `${BASE_URL}/queues/${qname}/retry_tasks/${taskKey}:kill`,
});
}
export async function deleteRetryTask( export async function deleteRetryTask(
qname: string, qname: string,
taskKey: string taskKey: string
@ -377,6 +423,27 @@ export async function runAllRetryTasks(qname: string): Promise<void> {
}); });
} }
export async function batchKillRetryTasks(
qname: string,
taskKeys: string[]
): Promise<BatchKillTasksResponse> {
const resp = await axios({
method: "post",
url: `${BASE_URL}/queues/${qname}/retry_tasks:batch_kill`,
data: {
task_keys: taskKeys,
},
});
return resp.data;
}
export async function killAllRetryTasks(qname: string): Promise<void> {
await axios({
method: "post",
url: `${BASE_URL}/queues/${qname}/retry_tasks:kill_all`,
});
}
export async function runDeadTask( export async function runDeadTask(
qname: string, qname: string,
taskKey: string taskKey: string

View File

@ -124,13 +124,13 @@ function DeadTasksTable(props: Props & ReduxProps) {
const handleBatchRunClick = () => { const handleBatchRunClick = () => {
props props
.batchDeleteDeadTasksAsync(queue, selectedKeys) .batchRunDeadTasksAsync(queue, selectedKeys)
.then(() => setSelectedKeys([])); .then(() => setSelectedKeys([]));
}; };
const handleBatchDeleteClick = () => { const handleBatchDeleteClick = () => {
props props
.batchRunDeadTasksAsync(queue, selectedKeys) .batchDeleteDeadTasksAsync(queue, selectedKeys)
.then(() => setSelectedKeys([])); .then(() => setSelectedKeys([]));
}; };

View File

@ -25,11 +25,14 @@ import syntaxHighlightStyle from "react-syntax-highlighter/dist/esm/styles/hljs/
import { import {
batchDeleteRetryTasksAsync, batchDeleteRetryTasksAsync,
batchRunRetryTasksAsync, batchRunRetryTasksAsync,
batchKillRetryTasksAsync,
deleteAllRetryTasksAsync, deleteAllRetryTasksAsync,
runAllRetryTasksAsync, runAllRetryTasksAsync,
killAllRetryTasksAsync,
listRetryTasksAsync, listRetryTasksAsync,
deleteRetryTaskAsync, deleteRetryTaskAsync,
runRetryTaskAsync, runRetryTaskAsync,
killRetryTaskAsync,
} from "../actions/tasksActions"; } from "../actions/tasksActions";
import { AppState } from "../store"; import { AppState } from "../store";
import TablePaginationActions, { import TablePaginationActions, {
@ -60,11 +63,14 @@ function mapStateToProps(state: AppState) {
const mapDispatchToProps = { const mapDispatchToProps = {
batchDeleteRetryTasksAsync, batchDeleteRetryTasksAsync,
batchRunRetryTasksAsync, batchRunRetryTasksAsync,
batchKillRetryTasksAsync,
deleteAllRetryTasksAsync, deleteAllRetryTasksAsync,
runAllRetryTasksAsync, runAllRetryTasksAsync,
killAllRetryTasksAsync,
listRetryTasksAsync, listRetryTasksAsync,
deleteRetryTaskAsync, deleteRetryTaskAsync,
runRetryTaskAsync, runRetryTaskAsync,
killRetryTaskAsync,
}; };
const connector = connect(mapStateToProps, mapDispatchToProps); const connector = connect(mapStateToProps, mapDispatchToProps);
@ -114,15 +120,25 @@ function RetryTasksTable(props: Props & ReduxProps) {
props.deleteAllRetryTasksAsync(queue); props.deleteAllRetryTasksAsync(queue);
}; };
const handleKillAllClick = () => {
props.killAllRetryTasksAsync(queue);
};
const handleBatchRunClick = () => { const handleBatchRunClick = () => {
props props
.batchDeleteRetryTasksAsync(queue, selectedKeys) .batchRunRetryTasksAsync(queue, selectedKeys)
.then(() => setSelectedKeys([])); .then(() => setSelectedKeys([]));
}; };
const handleBatchDeleteClick = () => { const handleBatchDeleteClick = () => {
props props
.batchRunRetryTasksAsync(queue, selectedKeys) .batchDeleteRetryTasksAsync(queue, selectedKeys)
.then(() => setSelectedKeys([]));
};
const handleBatchKillClick = () => {
props
.batchKillRetryTasksAsync(queue, selectedKeys)
.then(() => setSelectedKeys([])); .then(() => setSelectedKeys([]));
}; };
@ -163,8 +179,10 @@ function RetryTasksTable(props: Props & ReduxProps) {
showBatchActions={numSelected > 0} showBatchActions={numSelected > 0}
onRunAllClick={handleRunAllClick} onRunAllClick={handleRunAllClick}
onDeleteAllClick={handleDeleteAllClick} onDeleteAllClick={handleDeleteAllClick}
onKillAllClick={handleKillAllClick}
onBatchRunClick={handleBatchRunClick} onBatchRunClick={handleBatchRunClick}
onBatchDeleteClick={handleBatchDeleteClick} onBatchDeleteClick={handleBatchDeleteClick}
onBatchKillClick={handleBatchKillClick}
/> />
<TableContainer component={Paper}> <TableContainer component={Paper}>
<Table <Table
@ -212,6 +230,9 @@ function RetryTasksTable(props: Props & ReduxProps) {
onDeleteClick={() => { onDeleteClick={() => {
props.deleteRetryTaskAsync(task.queue, task.key); props.deleteRetryTaskAsync(task.queue, task.key);
}} }}
onKillClick={() => {
props.killRetryTaskAsync(task.queue, task.key);
}}
/> />
))} ))}
</TableBody> </TableBody>
@ -253,6 +274,7 @@ interface RowProps {
onSelectChange: (checked: boolean) => void; onSelectChange: (checked: boolean) => void;
onDeleteClick: () => void; onDeleteClick: () => void;
onRunClick: () => void; onRunClick: () => void;
onKillClick: () => void;
allActionPending: boolean; allActionPending: boolean;
} }
@ -295,6 +317,12 @@ function Row(props: RowProps) {
> >
Run Run
</Button> </Button>
<Button
onClick={props.onKillClick}
disabled={task.requestPending || props.allActionPending}
>
Kill
</Button>
<Button <Button
disabled={task.requestPending} disabled={task.requestPending}
onClick={props.onDeleteClick || props.allActionPending} onClick={props.onDeleteClick || props.allActionPending}

View File

@ -25,11 +25,14 @@ import syntaxHighlightStyle from "react-syntax-highlighter/dist/esm/styles/hljs/
import { import {
batchDeleteScheduledTasksAsync, batchDeleteScheduledTasksAsync,
batchRunScheduledTasksAsync, batchRunScheduledTasksAsync,
batchKillScheduledTasksAsync,
deleteAllScheduledTasksAsync, deleteAllScheduledTasksAsync,
runAllScheduledTasksAsync, runAllScheduledTasksAsync,
killAllScheduledTasksAsync,
listScheduledTasksAsync, listScheduledTasksAsync,
deleteScheduledTaskAsync, deleteScheduledTaskAsync,
runScheduledTaskAsync, runScheduledTaskAsync,
killScheduledTaskAsync,
} from "../actions/tasksActions"; } from "../actions/tasksActions";
import { AppState } from "../store"; import { AppState } from "../store";
import TablePaginationActions, { import TablePaginationActions, {
@ -59,12 +62,15 @@ function mapStateToProps(state: AppState) {
const mapDispatchToProps = { const mapDispatchToProps = {
listScheduledTasksAsync, listScheduledTasksAsync,
deleteScheduledTaskAsync,
batchDeleteScheduledTasksAsync, batchDeleteScheduledTasksAsync,
batchRunScheduledTasksAsync, batchRunScheduledTasksAsync,
batchKillScheduledTasksAsync,
deleteAllScheduledTasksAsync, deleteAllScheduledTasksAsync,
runAllScheduledTasksAsync, runAllScheduledTasksAsync,
killAllScheduledTasksAsync,
deleteScheduledTaskAsync,
runScheduledTaskAsync, runScheduledTaskAsync,
killScheduledTaskAsync,
}; };
const connector = connect(mapStateToProps, mapDispatchToProps); const connector = connect(mapStateToProps, mapDispatchToProps);
@ -114,15 +120,25 @@ function ScheduledTasksTable(props: Props & ReduxProps) {
props.deleteAllScheduledTasksAsync(queue); props.deleteAllScheduledTasksAsync(queue);
}; };
const handleKillAllClick = () => {
props.killAllScheduledTasksAsync(queue);
};
const handleBatchRunClick = () => { const handleBatchRunClick = () => {
props props
.batchDeleteScheduledTasksAsync(queue, selectedKeys) .batchRunScheduledTasksAsync(queue, selectedKeys)
.then(() => setSelectedKeys([])); .then(() => setSelectedKeys([]));
}; };
const handleBatchDeleteClick = () => { const handleBatchDeleteClick = () => {
props props
.batchRunScheduledTasksAsync(queue, selectedKeys) .batchDeleteScheduledTasksAsync(queue, selectedKeys)
.then(() => setSelectedKeys([]));
};
const handleBatchKillClick = () => {
props
.batchKillScheduledTasksAsync(queue, selectedKeys)
.then(() => setSelectedKeys([])); .then(() => setSelectedKeys([]));
}; };
@ -159,9 +175,11 @@ function ScheduledTasksTable(props: Props & ReduxProps) {
batchActionPending={props.batchActionPending} batchActionPending={props.batchActionPending}
showBatchActions={numSelected > 0} showBatchActions={numSelected > 0}
onRunAllClick={handleRunAllClick} onRunAllClick={handleRunAllClick}
onKillAllClick={handleKillAllClick}
onDeleteAllClick={handleDeleteAllClick} onDeleteAllClick={handleDeleteAllClick}
onBatchRunClick={handleBatchRunClick} onBatchRunClick={handleBatchRunClick}
onBatchDeleteClick={handleBatchDeleteClick} onBatchDeleteClick={handleBatchDeleteClick}
onBatchKillClick={handleBatchKillClick}
/> />
<TableContainer component={Paper}> <TableContainer component={Paper}>
<Table <Table
@ -209,6 +227,9 @@ function ScheduledTasksTable(props: Props & ReduxProps) {
onDeleteClick={() => { onDeleteClick={() => {
props.deleteScheduledTaskAsync(queue, task.key); props.deleteScheduledTaskAsync(queue, task.key);
}} }}
onKillClick={() => {
props.killScheduledTaskAsync(queue, task.key);
}}
/> />
))} ))}
</TableBody> </TableBody>
@ -250,6 +271,7 @@ interface RowProps {
onSelectChange: (checked: boolean) => void; onSelectChange: (checked: boolean) => void;
onRunClick: () => void; onRunClick: () => void;
onDeleteClick: () => void; onDeleteClick: () => void;
onKillClick: () => void;
allActionPending: boolean; allActionPending: boolean;
} }
@ -289,6 +311,12 @@ function Row(props: RowProps) {
> >
Run Run
</Button> </Button>
<Button
onClick={props.onKillClick}
disabled={task.requestPending || props.allActionPending}
>
Kill
</Button>
<Button <Button
onClick={props.onDeleteClick} onClick={props.onDeleteClick}
disabled={task.requestPending || props.allActionPending} disabled={task.requestPending || props.allActionPending}

View File

@ -20,10 +20,12 @@ interface Props {
allActionPending: boolean; allActionPending: boolean;
onRunAllClick: () => void; onRunAllClick: () => void;
onDeleteAllClick: () => void; onDeleteAllClick: () => void;
onKillAllClick?: () => void;
showBatchActions: boolean; showBatchActions: boolean;
batchActionPending: boolean; batchActionPending: boolean;
onBatchRunClick: () => void; onBatchRunClick: () => void;
onBatchDeleteClick: () => void; onBatchDeleteClick: () => void;
onBatchKillClick?: () => void;
} }
export default function TableActions(props: Props) { export default function TableActions(props: Props) {
@ -61,6 +63,18 @@ export default function TableActions(props: Props) {
> >
Run All Run All
</MenuItem> </MenuItem>
{props.onKillAllClick && (
<MenuItem
onClick={() => {
if (!props.onKillAllClick) return;
props.onKillAllClick();
closeMenu();
}}
disabled={props.allActionPending}
>
Kill All
</MenuItem>
)}
<MenuItem <MenuItem
onClick={() => { onClick={() => {
props.onDeleteAllClick(); props.onDeleteAllClick();
@ -83,7 +97,17 @@ export default function TableActions(props: Props) {
> >
Run Run
</Button> </Button>
<Button>Kill</Button> {props.onBatchKillClick && (
<Button
disabled={props.batchActionPending}
onClick={() => {
if (!props.onBatchKillClick) return;
props.onBatchKillClick();
}}
>
Kill
</Button>
)}
<Button <Button
disabled={props.batchActionPending} disabled={props.batchActionPending}
onClick={props.onBatchDeleteClick} onClick={props.onBatchDeleteClick}

View File

@ -17,6 +17,8 @@ import {
BATCH_DELETE_DEAD_TASKS_SUCCESS, BATCH_DELETE_DEAD_TASKS_SUCCESS,
BATCH_DELETE_RETRY_TASKS_SUCCESS, BATCH_DELETE_RETRY_TASKS_SUCCESS,
BATCH_DELETE_SCHEDULED_TASKS_SUCCESS, BATCH_DELETE_SCHEDULED_TASKS_SUCCESS,
BATCH_KILL_RETRY_TASKS_SUCCESS,
BATCH_KILL_SCHEDULED_TASKS_SUCCESS,
BATCH_RUN_DEAD_TASKS_SUCCESS, BATCH_RUN_DEAD_TASKS_SUCCESS,
BATCH_RUN_RETRY_TASKS_SUCCESS, BATCH_RUN_RETRY_TASKS_SUCCESS,
BATCH_RUN_SCHEDULED_TASKS_SUCCESS, BATCH_RUN_SCHEDULED_TASKS_SUCCESS,
@ -26,6 +28,10 @@ import {
DELETE_DEAD_TASK_SUCCESS, DELETE_DEAD_TASK_SUCCESS,
DELETE_RETRY_TASK_SUCCESS, DELETE_RETRY_TASK_SUCCESS,
DELETE_SCHEDULED_TASK_SUCCESS, DELETE_SCHEDULED_TASK_SUCCESS,
KILL_ALL_RETRY_TASKS_SUCCESS,
KILL_ALL_SCHEDULED_TASKS_SUCCESS,
KILL_RETRY_TASK_SUCCESS,
KILL_SCHEDULED_TASK_SUCCESS,
LIST_ACTIVE_TASKS_SUCCESS, LIST_ACTIVE_TASKS_SUCCESS,
LIST_DEAD_TASKS_SUCCESS, LIST_DEAD_TASKS_SUCCESS,
LIST_PENDING_TASKS_SUCCESS, LIST_PENDING_TASKS_SUCCESS,
@ -216,6 +222,40 @@ function queuesReducer(
return { ...state, data: newData }; return { ...state, data: newData };
} }
case KILL_SCHEDULED_TASK_SUCCESS: {
const newData = state.data.map((queueInfo) => {
if (queueInfo.name !== action.queue) {
return queueInfo;
}
return {
...queueInfo,
currentStats: {
...queueInfo.currentStats,
dead: queueInfo.currentStats.dead + 1,
scheduled: queueInfo.currentStats.scheduled - 1,
},
};
});
return { ...state, data: newData };
}
case KILL_RETRY_TASK_SUCCESS: {
const newData = state.data.map((queueInfo) => {
if (queueInfo.name !== action.queue) {
return queueInfo;
}
return {
...queueInfo,
currentStats: {
...queueInfo.currentStats,
dead: queueInfo.currentStats.dead + 1,
retry: queueInfo.currentStats.retry - 1,
},
};
});
return { ...state, data: newData };
}
case DELETE_SCHEDULED_TASK_SUCCESS: { case DELETE_SCHEDULED_TASK_SUCCESS: {
const newData = state.data.map((queueInfo) => { const newData = state.data.map((queueInfo) => {
if (queueInfo.name !== action.queue) { if (queueInfo.name !== action.queue) {
@ -253,6 +293,25 @@ function queuesReducer(
return { ...state, data: newData }; return { ...state, data: newData };
} }
case BATCH_KILL_SCHEDULED_TASKS_SUCCESS: {
const newData = state.data.map((queueInfo) => {
if (queueInfo.name !== action.queue) {
return queueInfo;
}
return {
...queueInfo,
currentStats: {
...queueInfo.currentStats,
dead: queueInfo.currentStats.dead + action.payload.dead_keys.length,
scheduled:
queueInfo.currentStats.scheduled -
action.payload.dead_keys.length,
},
};
});
return { ...state, data: newData };
}
case BATCH_DELETE_SCHEDULED_TASKS_SUCCESS: { case BATCH_DELETE_SCHEDULED_TASKS_SUCCESS: {
const newData = state.data.map((queueInfo) => { const newData = state.data.map((queueInfo) => {
if (queueInfo.name !== action.queue) { if (queueInfo.name !== action.queue) {
@ -289,6 +348,24 @@ function queuesReducer(
return { ...state, data: newData }; return { ...state, data: newData };
} }
case KILL_ALL_SCHEDULED_TASKS_SUCCESS: {
const newData = state.data.map((queueInfo) => {
if (queueInfo.name !== action.queue) {
return queueInfo;
}
return {
...queueInfo,
currentStats: {
...queueInfo.currentStats,
dead:
queueInfo.currentStats.dead + queueInfo.currentStats.scheduled,
scheduled: 0,
},
};
});
return { ...state, data: newData };
}
case DELETE_ALL_SCHEDULED_TASKS_SUCCESS: { case DELETE_ALL_SCHEDULED_TASKS_SUCCESS: {
const newData = state.data.map((queueInfo) => { const newData = state.data.map((queueInfo) => {
if (queueInfo.name !== action.queue) { if (queueInfo.name !== action.queue) {
@ -341,6 +418,25 @@ function queuesReducer(
return { ...state, data: newData }; return { ...state, data: newData };
} }
case BATCH_KILL_RETRY_TASKS_SUCCESS: {
const newData = state.data.map((queueInfo) => {
if (queueInfo.name !== action.queue) {
return queueInfo;
}
return {
...queueInfo,
currentStats: {
...queueInfo.currentStats,
dead:
queueInfo.currentStats.pending + action.payload.dead_keys.length,
retry:
queueInfo.currentStats.retry - action.payload.dead_keys.length,
},
};
});
return { ...state, data: newData };
}
case BATCH_DELETE_RETRY_TASKS_SUCCESS: { case BATCH_DELETE_RETRY_TASKS_SUCCESS: {
const newData = state.data.map((queueInfo) => { const newData = state.data.map((queueInfo) => {
if (queueInfo.name !== action.queue) { if (queueInfo.name !== action.queue) {
@ -376,6 +472,23 @@ function queuesReducer(
return { ...state, data: newData }; return { ...state, data: newData };
} }
case KILL_ALL_RETRY_TASKS_SUCCESS: {
const newData = state.data.map((queueInfo) => {
if (queueInfo.name !== action.queue) {
return queueInfo;
}
return {
...queueInfo,
currentStats: {
...queueInfo.currentStats,
dead: queueInfo.currentStats.dead + queueInfo.currentStats.retry,
retry: 0,
},
};
});
return { ...state, data: newData };
}
case DELETE_ALL_RETRY_TASKS_SUCCESS: { case DELETE_ALL_RETRY_TASKS_SUCCESS: {
const newData = state.data.map((queueInfo) => { const newData = state.data.map((queueInfo) => {
if (queueInfo.name !== action.queue) { if (queueInfo.name !== action.queue) {

View File

@ -6,6 +6,8 @@ import {
BATCH_DELETE_DEAD_TASKS_SUCCESS, BATCH_DELETE_DEAD_TASKS_SUCCESS,
BATCH_DELETE_RETRY_TASKS_SUCCESS, BATCH_DELETE_RETRY_TASKS_SUCCESS,
BATCH_DELETE_SCHEDULED_TASKS_SUCCESS, BATCH_DELETE_SCHEDULED_TASKS_SUCCESS,
BATCH_KILL_RETRY_TASKS_SUCCESS,
BATCH_KILL_SCHEDULED_TASKS_SUCCESS,
BATCH_RUN_DEAD_TASKS_SUCCESS, BATCH_RUN_DEAD_TASKS_SUCCESS,
BATCH_RUN_RETRY_TASKS_SUCCESS, BATCH_RUN_RETRY_TASKS_SUCCESS,
BATCH_RUN_SCHEDULED_TASKS_SUCCESS, BATCH_RUN_SCHEDULED_TASKS_SUCCESS,
@ -15,6 +17,10 @@ import {
DELETE_DEAD_TASK_SUCCESS, DELETE_DEAD_TASK_SUCCESS,
DELETE_RETRY_TASK_SUCCESS, DELETE_RETRY_TASK_SUCCESS,
DELETE_SCHEDULED_TASK_SUCCESS, DELETE_SCHEDULED_TASK_SUCCESS,
KILL_ALL_RETRY_TASKS_SUCCESS,
KILL_ALL_SCHEDULED_TASKS_SUCCESS,
KILL_RETRY_TASK_SUCCESS,
KILL_SCHEDULED_TASK_SUCCESS,
RUN_ALL_DEAD_TASKS_SUCCESS, RUN_ALL_DEAD_TASKS_SUCCESS,
RUN_ALL_RETRY_TASKS_SUCCESS, RUN_ALL_RETRY_TASKS_SUCCESS,
RUN_ALL_SCHEDULED_TASKS_SUCCESS, RUN_ALL_SCHEDULED_TASKS_SUCCESS,
@ -68,6 +74,20 @@ function snackbarReducer(
message: `Dead task ${action.taskKey} is now pending`, message: `Dead task ${action.taskKey} is now pending`,
}; };
case KILL_SCHEDULED_TASK_SUCCESS:
return {
isOpen: true,
// TODO: show only task id
message: `Scheduled task ${action.taskKey} is now dead`,
};
case KILL_RETRY_TASK_SUCCESS:
return {
isOpen: true,
// TODO: show only task id
message: `Retry task ${action.taskKey} is now dead`,
};
case DELETE_SCHEDULED_TASK_SUCCESS: case DELETE_SCHEDULED_TASK_SUCCESS:
return { return {
isOpen: true, isOpen: true,
@ -85,6 +105,14 @@ function snackbarReducer(
}; };
} }
case BATCH_KILL_SCHEDULED_TASKS_SUCCESS: {
const n = action.payload.dead_keys.length;
return {
isOpen: true,
message: `${n} scheduled ${n === 1 ? "task is" : "tasks are"} now dead`,
};
}
case BATCH_DELETE_SCHEDULED_TASKS_SUCCESS: { case BATCH_DELETE_SCHEDULED_TASKS_SUCCESS: {
const n = action.payload.deleted_keys.length; const n = action.payload.deleted_keys.length;
return { return {
@ -99,6 +127,12 @@ function snackbarReducer(
message: "All scheduled tasks are now pending", message: "All scheduled tasks are now pending",
}; };
case KILL_ALL_SCHEDULED_TASKS_SUCCESS:
return {
isOpen: true,
message: "All scheduled tasks are now dead",
};
case DELETE_ALL_SCHEDULED_TASKS_SUCCESS: case DELETE_ALL_SCHEDULED_TASKS_SUCCESS:
return { return {
isOpen: true, isOpen: true,
@ -120,6 +154,14 @@ function snackbarReducer(
}; };
} }
case BATCH_KILL_RETRY_TASKS_SUCCESS: {
const n = action.payload.dead_keys.length;
return {
isOpen: true,
message: `${n} retry ${n === 1 ? "task is" : "tasks are"} now dead`,
};
}
case BATCH_DELETE_RETRY_TASKS_SUCCESS: { case BATCH_DELETE_RETRY_TASKS_SUCCESS: {
const n = action.payload.deleted_keys.length; const n = action.payload.deleted_keys.length;
return { return {
@ -134,6 +176,12 @@ function snackbarReducer(
message: "All retry tasks are now pending", message: "All retry tasks are now pending",
}; };
case KILL_ALL_RETRY_TASKS_SUCCESS:
return {
isOpen: true,
message: "All retry tasks are now dead",
};
case DELETE_ALL_RETRY_TASKS_SUCCESS: case DELETE_ALL_RETRY_TASKS_SUCCESS:
return { return {
isOpen: true, isOpen: true,

View File

@ -72,6 +72,24 @@ import {
RUN_SCHEDULED_TASK_BEGIN, RUN_SCHEDULED_TASK_BEGIN,
RUN_SCHEDULED_TASK_SUCCESS, RUN_SCHEDULED_TASK_SUCCESS,
RUN_SCHEDULED_TASK_ERROR, RUN_SCHEDULED_TASK_ERROR,
KILL_SCHEDULED_TASK_BEGIN,
KILL_SCHEDULED_TASK_SUCCESS,
KILL_SCHEDULED_TASK_ERROR,
KILL_ALL_SCHEDULED_TASKS_BEGIN,
KILL_ALL_SCHEDULED_TASKS_SUCCESS,
KILL_ALL_SCHEDULED_TASKS_ERROR,
BATCH_KILL_SCHEDULED_TASKS_BEGIN,
BATCH_KILL_SCHEDULED_TASKS_ERROR,
BATCH_KILL_SCHEDULED_TASKS_SUCCESS,
KILL_RETRY_TASK_BEGIN,
KILL_RETRY_TASK_SUCCESS,
KILL_RETRY_TASK_ERROR,
KILL_ALL_RETRY_TASKS_BEGIN,
KILL_ALL_RETRY_TASKS_SUCCESS,
KILL_ALL_RETRY_TASKS_ERROR,
BATCH_KILL_RETRY_TASKS_SUCCESS,
BATCH_KILL_RETRY_TASKS_BEGIN,
BATCH_KILL_RETRY_TASKS_ERROR,
} from "../actions/tasksActions"; } from "../actions/tasksActions";
import { import {
ActiveTask, ActiveTask,
@ -396,6 +414,7 @@ function tasksReducer(
}; };
case RUN_SCHEDULED_TASK_BEGIN: case RUN_SCHEDULED_TASK_BEGIN:
case KILL_SCHEDULED_TASK_BEGIN:
case DELETE_SCHEDULED_TASK_BEGIN: case DELETE_SCHEDULED_TASK_BEGIN:
return { return {
...state, ...state,
@ -411,6 +430,7 @@ function tasksReducer(
}; };
case RUN_SCHEDULED_TASK_SUCCESS: case RUN_SCHEDULED_TASK_SUCCESS:
case KILL_SCHEDULED_TASK_SUCCESS:
case DELETE_SCHEDULED_TASK_SUCCESS: case DELETE_SCHEDULED_TASK_SUCCESS:
return { return {
...state, ...state,
@ -423,6 +443,7 @@ function tasksReducer(
}; };
case RUN_SCHEDULED_TASK_ERROR: case RUN_SCHEDULED_TASK_ERROR:
case KILL_SCHEDULED_TASK_ERROR:
case DELETE_SCHEDULED_TASK_ERROR: case DELETE_SCHEDULED_TASK_ERROR:
return { return {
...state, ...state,
@ -438,6 +459,7 @@ function tasksReducer(
}; };
case RUN_ALL_SCHEDULED_TASKS_BEGIN: case RUN_ALL_SCHEDULED_TASKS_BEGIN:
case KILL_ALL_SCHEDULED_TASKS_BEGIN:
case DELETE_ALL_SCHEDULED_TASKS_BEGIN: case DELETE_ALL_SCHEDULED_TASKS_BEGIN:
return { return {
...state, ...state,
@ -448,6 +470,7 @@ function tasksReducer(
}; };
case RUN_ALL_SCHEDULED_TASKS_SUCCESS: case RUN_ALL_SCHEDULED_TASKS_SUCCESS:
case KILL_ALL_SCHEDULED_TASKS_SUCCESS:
case DELETE_ALL_SCHEDULED_TASKS_SUCCESS: case DELETE_ALL_SCHEDULED_TASKS_SUCCESS:
return { return {
...state, ...state,
@ -459,6 +482,7 @@ function tasksReducer(
}; };
case RUN_ALL_SCHEDULED_TASKS_ERROR: case RUN_ALL_SCHEDULED_TASKS_ERROR:
case KILL_ALL_SCHEDULED_TASKS_ERROR:
case DELETE_ALL_SCHEDULED_TASKS_ERROR: case DELETE_ALL_SCHEDULED_TASKS_ERROR:
return { return {
...state, ...state,
@ -469,6 +493,7 @@ function tasksReducer(
}; };
case BATCH_RUN_SCHEDULED_TASKS_BEGIN: case BATCH_RUN_SCHEDULED_TASKS_BEGIN:
case BATCH_KILL_SCHEDULED_TASKS_BEGIN:
case BATCH_DELETE_SCHEDULED_TASKS_BEGIN: case BATCH_DELETE_SCHEDULED_TASKS_BEGIN:
return { return {
...state, ...state,
@ -501,6 +526,20 @@ function tasksReducer(
}; };
} }
case BATCH_KILL_SCHEDULED_TASKS_SUCCESS: {
const newData = state.scheduledTasks.data.filter(
(task) => !action.payload.dead_keys.includes(task.key)
);
return {
...state,
scheduledTasks: {
...state.scheduledTasks,
batchActionPending: false,
data: newData,
},
};
}
case BATCH_DELETE_SCHEDULED_TASKS_SUCCESS: { case BATCH_DELETE_SCHEDULED_TASKS_SUCCESS: {
const newData = state.scheduledTasks.data.filter( const newData = state.scheduledTasks.data.filter(
(task) => !action.payload.deleted_keys.includes(task.key) (task) => !action.payload.deleted_keys.includes(task.key)
@ -516,6 +555,7 @@ function tasksReducer(
} }
case BATCH_RUN_SCHEDULED_TASKS_ERROR: case BATCH_RUN_SCHEDULED_TASKS_ERROR:
case BATCH_KILL_SCHEDULED_TASKS_ERROR:
case BATCH_DELETE_SCHEDULED_TASKS_ERROR: case BATCH_DELETE_SCHEDULED_TASKS_ERROR:
return { return {
...state, ...state,
@ -535,6 +575,7 @@ function tasksReducer(
}; };
case RUN_RETRY_TASK_BEGIN: case RUN_RETRY_TASK_BEGIN:
case KILL_RETRY_TASK_BEGIN:
case DELETE_RETRY_TASK_BEGIN: case DELETE_RETRY_TASK_BEGIN:
return { return {
...state, ...state,
@ -550,6 +591,7 @@ function tasksReducer(
}; };
case RUN_RETRY_TASK_SUCCESS: case RUN_RETRY_TASK_SUCCESS:
case KILL_RETRY_TASK_SUCCESS:
case DELETE_RETRY_TASK_SUCCESS: case DELETE_RETRY_TASK_SUCCESS:
return { return {
...state, ...state,
@ -562,6 +604,7 @@ function tasksReducer(
}; };
case RUN_RETRY_TASK_ERROR: case RUN_RETRY_TASK_ERROR:
case KILL_RETRY_TASK_ERROR:
case DELETE_RETRY_TASK_ERROR: case DELETE_RETRY_TASK_ERROR:
return { return {
...state, ...state,
@ -577,6 +620,7 @@ function tasksReducer(
}; };
case RUN_ALL_RETRY_TASKS_BEGIN: case RUN_ALL_RETRY_TASKS_BEGIN:
case KILL_ALL_RETRY_TASKS_BEGIN:
case DELETE_ALL_RETRY_TASKS_BEGIN: case DELETE_ALL_RETRY_TASKS_BEGIN:
return { return {
...state, ...state,
@ -587,6 +631,7 @@ function tasksReducer(
}; };
case RUN_ALL_RETRY_TASKS_SUCCESS: case RUN_ALL_RETRY_TASKS_SUCCESS:
case KILL_ALL_RETRY_TASKS_SUCCESS:
case DELETE_ALL_RETRY_TASKS_SUCCESS: case DELETE_ALL_RETRY_TASKS_SUCCESS:
return { return {
...state, ...state,
@ -598,6 +643,7 @@ function tasksReducer(
}; };
case RUN_ALL_RETRY_TASKS_ERROR: case RUN_ALL_RETRY_TASKS_ERROR:
case KILL_ALL_RETRY_TASKS_ERROR:
case DELETE_ALL_RETRY_TASKS_ERROR: case DELETE_ALL_RETRY_TASKS_ERROR:
return { return {
...state, ...state,
@ -608,6 +654,7 @@ function tasksReducer(
}; };
case BATCH_RUN_RETRY_TASKS_BEGIN: case BATCH_RUN_RETRY_TASKS_BEGIN:
case BATCH_KILL_RETRY_TASKS_BEGIN:
case BATCH_DELETE_RETRY_TASKS_BEGIN: case BATCH_DELETE_RETRY_TASKS_BEGIN:
return { return {
...state, ...state,
@ -640,6 +687,20 @@ function tasksReducer(
}; };
} }
case BATCH_KILL_RETRY_TASKS_SUCCESS: {
const newData = state.retryTasks.data.filter(
(task) => !action.payload.dead_keys.includes(task.key)
);
return {
...state,
retryTasks: {
...state.retryTasks,
batchActionPending: false,
data: newData,
},
};
}
case BATCH_DELETE_RETRY_TASKS_SUCCESS: { case BATCH_DELETE_RETRY_TASKS_SUCCESS: {
const newData = state.retryTasks.data.filter( const newData = state.retryTasks.data.filter(
(task) => !action.payload.deleted_keys.includes(task.key) (task) => !action.payload.deleted_keys.includes(task.key)
@ -655,6 +716,7 @@ function tasksReducer(
} }
case BATCH_RUN_RETRY_TASKS_ERROR: case BATCH_RUN_RETRY_TASKS_ERROR:
case BATCH_KILL_RETRY_TASKS_ERROR:
case BATCH_DELETE_RETRY_TASKS_ERROR: case BATCH_DELETE_RETRY_TASKS_ERROR:
return { return {
...state, ...state,