judge: refactor: use common JudgeTask interface

This commit is contained in:
undefined committed 2022-09-06 13:02:46 +08:00
1 parent e2d8df1428
commit 636446c43a
20 files changed
+291 -506

No files matched your search

+2 -20
View File
@@ -1,27 +1,9 @@
import PQueue from 'p-queue';
import type { NormalizedSubtask } from '@hydrooj/utils/lib/common';
import type { LangConfig } from '@hydrooj/utils/lib/lang';
import type { JudgeResultBody } from 'hydrooj';
import { Execute } from '../interface';
import { CopyInFile } from '../sandbox/interface';
import { JudgeTask } from '../task';
export type Context = JudgeTaskInterface & RuntimeContext;
export interface JudgeTaskInterface {
next(data: Partial<JudgeResultBody>, id?: number): void;
end(data: Partial<JudgeResultBody>): void;
getLang: (name: string) => LangConfig;
stat: Record<string, Date>;
lang: string;
code: CopyInFile;
tmpdir: string;
input?: string;
clean: Function[];
config: Config;
env?: Record<string, string>;
request: Record<string, any>;
}
export type Context = JudgeTask & RuntimeContext;
export interface RuntimeContext {
total_score?: number;