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

@@ -51,6 +51,11 @@ export interface BatchRunTasksResponse {
error_keys: string[];
}
export interface BatchKillTasksResponse {
dead_keys: string[];
error_keys: string[];
}
export interface Queue {
queue: string;
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(
qname: 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(
qname: 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(
qname: 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(
qname: string,
taskKey: string