mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
judge: 使用filename配置时限制并行任务数量为1
This commit is contained in:
1 parent
591acbb285
commit
88c15193d6
2 files changed
+3
-4
No files matched your search
@@ -143,7 +143,8 @@ export const judge = async (ctx) => {
|
|||||||
ctx.total_score = 0;
|
ctx.total_score = 0;
|
||||||
ctx.total_memory_usage_kb = 0;
|
ctx.total_memory_usage_kb = 0;
|
||||||
ctx.total_time_usage_ms = 0;
|
ctx.total_time_usage_ms = 0;
|
||||||
ctx.queue = new Queue({ concurrency: ctx.config.concurrency || 2 });
|
// sandbox seems cannot handle concurrent tasks with output file correctly
|
||||||
|
ctx.queue = new Queue({ concurrency: ctx.config.concurrency || (ctx.config.filename ? 1 : 2) });
|
||||||
for (const sid in ctx.config.subtasks) tasks.push(judgeSubtask(ctx.config.subtasks[sid])(ctx));
|
for (const sid in ctx.config.subtasks) tasks.push(judgeSubtask(ctx.config.subtasks[sid])(ctx));
|
||||||
await Promise.all(tasks);
|
await Promise.all(tasks);
|
||||||
ctx.stat.done = new Date();
|
ctx.stat.done = new Date();
|
||||||
|
|||||||
@@ -104,9 +104,7 @@ export async function run(execute, params?) {
|
|||||||
else ret.stdout = result.files.stdout || '';
|
else ret.stdout = result.files.stdout || '';
|
||||||
if (params.stderr) await fs.writeFile(params.stderr, result.files.stderr || '');
|
if (params.stderr) await fs.writeFile(params.stderr, result.files.stderr || '');
|
||||||
else ret.stderr = result.files.stderr || '';
|
else ret.stderr = result.files.stderr || '';
|
||||||
if (result.error) {
|
if (result.error) ret.error = result.error;
|
||||||
ret.error = result.error;
|
|
||||||
}
|
|
||||||
ret.files = result.files;
|
ret.files = result.files;
|
||||||
ret.fileIds = result.fileIds || {};
|
ret.fileIds = result.fileIds || {};
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
Reference in new issue
Block a user