mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-15 06:12:18 +00:00
kill jobs works
This commit is contained in:
1 parent
0af16334ee
commit
e6a7f79492
2 files changed
+26
-16
No files matched your search
@@ -29,9 +29,13 @@ export function KillTtsInferenceJobsIsError(response: KillTtsInferenceJobsRespon
|
||||
return response?.success === false;
|
||||
}
|
||||
|
||||
export async function KillTtsInferenceJobs(request: KillTtsInferenceJobsRequest) : Promise<KillTtsInferenceJobsResponse>
|
||||
export async function KillTtsInferenceJobs(killAction: KillAction) : Promise<KillTtsInferenceJobsResponse>
|
||||
{
|
||||
const endpoint = new ApiConfig().killTtsInferenceJobs();
|
||||
|
||||
const request : KillTtsInferenceJobsRequest = {
|
||||
kill_action: killAction,
|
||||
};
|
||||
|
||||
return await fetch(endpoint, {
|
||||
method: 'POST',
|
||||
|
||||
+21
-15
@@ -6,6 +6,7 @@ import { GetTtsInferenceStats, GetTtsInferenceStatsIsOk } from '../../../api/mod
|
||||
import { GetW2lInferenceStats, GetW2lInferenceStatsIsOk } from '../../../api/moderation/GetW2lInferenceStats';
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
import { faBomb, faRedo } from '@fortawesome/free-solid-svg-icons';
|
||||
import { KillAction, KillTtsInferenceJobsRequest, KillTtsInferenceJobsIsSuccess, KillTtsInferenceJobs } from '@storyteller/components/src/api/moderation/tts/KillTtsInferenceJobs';
|
||||
|
||||
interface Props {
|
||||
sessionWrapper: SessionWrapper,
|
||||
@@ -52,14 +53,23 @@ function ModerationJobStatsFc(props: Props) {
|
||||
}, [reloadStats]);
|
||||
|
||||
const killPending = async () => {
|
||||
reloadStats();
|
||||
await doKill(KillAction.AllPending);
|
||||
}
|
||||
|
||||
const killPendingAndFailed = async () => {
|
||||
reloadStats();
|
||||
await doKill(KillAction.AllPendingAndFailed);
|
||||
}
|
||||
|
||||
const killZeroPriorityPending = async () => {
|
||||
reloadStats();
|
||||
await doKill(KillAction.ZeroPriorityPending);
|
||||
}
|
||||
|
||||
const doKill = async(killAction: KillAction) => {
|
||||
const response = await KillTtsInferenceJobs(killAction);
|
||||
|
||||
if (KillTtsInferenceJobsIsSuccess(response)) {
|
||||
reloadStats();
|
||||
}
|
||||
}
|
||||
|
||||
if (ttsPendingJobCount === -1 && w2lPendingJobCount === -1) {
|
||||
@@ -109,31 +119,27 @@ function ModerationJobStatsFc(props: Props) {
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>
|
||||
All Jobs
|
||||
Pending Jobs (All)
|
||||
</th>
|
||||
<td>{ttsPendingJobCount} pending </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Priority > 0
|
||||
Pending Jobs (Priority > 0)
|
||||
</th>
|
||||
<td>{ttsPendingJobCount} pending </td>
|
||||
<td>{ttsPendingPriorityNonzeroJobCount} pending </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Priority > 1
|
||||
Pending Jobs (Priority > 1)
|
||||
</th>
|
||||
<td>{ttsPendingJobCount} pending </td>
|
||||
<td>{ttsPendingPriorityGtOneJobCount} pending </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Retryably failed
|
||||
Failed Jobs w/ Retry
|
||||
</th>
|
||||
<td>{ttsPendingJobCount} pending </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Wait time</th>
|
||||
<th>summary statistics, job counts, etc.</th>
|
||||
<td>{ttsAttemptFailedJobCount} pending </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -168,7 +174,7 @@ function ModerationJobStatsFc(props: Props) {
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>
|
||||
All Jobs
|
||||
Pending Jobs (All)
|
||||
</th>
|
||||
<td>{w2lPendingJobCount} pending </td>
|
||||
</tr>
|
||||
|
||||
Reference in new issue
Block a user