mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 09:46:28 +08:00
judge: 支持调整stdio缓冲区大小
This commit is contained in:
1 parent
91f364d1b9
commit
bb856bacce
9 files changed
+24
-16
No files matched your search
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@hydrooj/hydrojudge",
|
||||
"bin": "bin/hydrojudge.js",
|
||||
"version": "2.3.4",
|
||||
"version": "2.3.5",
|
||||
"main": "package.json",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||
@@ -14,7 +14,7 @@
|
||||
"lodash": "^4.17.20",
|
||||
"p-queue": "^6.6.1",
|
||||
"shell-quote": "^1.7.2",
|
||||
"systeminformation": "^5.0.8",
|
||||
"systeminformation": "^5.0.9",
|
||||
"yargs": "^16.2.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
||||
@@ -10,6 +10,10 @@ tmpfs_size:
|
||||
type: text
|
||||
name: Tmpfs size
|
||||
default: 256m
|
||||
stdio_size:
|
||||
type: text
|
||||
name: Stdout/Stderr size
|
||||
default: 32m
|
||||
testcases_max:
|
||||
type: number
|
||||
name: Max testcases per problem
|
||||
|
||||
@@ -13,6 +13,7 @@ let config = {
|
||||
cache_dir: path.resolve(os.homedir(), '.cache', 'hydro', 'judge'),
|
||||
tmp_dir: path.resolve(os.tmpdir(), 'hydro', 'judge'),
|
||||
tmpfs_size: '256m',
|
||||
stdio_size: '32m',
|
||||
retry_delay_sec: 15,
|
||||
sandbox_host: 'http://localhost:5050',
|
||||
testcases_max: 100,
|
||||
|
||||
@@ -3,7 +3,8 @@ import fs from 'fs-extra';
|
||||
import { argv } from 'yargs';
|
||||
import * as STATUS from './status';
|
||||
import { SystemError } from './error';
|
||||
import { cmd } from './utils';
|
||||
import { cmd, parseMemoryMB } from './utils';
|
||||
import { getConfig } from './config';
|
||||
|
||||
const env = ['PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 'HOME=/w'];
|
||||
const axios = Axios.create({ baseURL: argv.sandbox as string || 'http://localhost:5050' });
|
||||
@@ -26,13 +27,14 @@ function proc({
|
||||
process_limit = 32,
|
||||
stdin = '', copyIn = {}, copyOut = [], copyOutCached = [],
|
||||
} = {}) {
|
||||
const size = parseMemoryMB(getConfig('stdio_size'));
|
||||
return {
|
||||
args: cmd(execute.replace(/\$\{dir\}/g, '/w')),
|
||||
env,
|
||||
files: [
|
||||
stdin ? { src: stdin } : { content: '' },
|
||||
{ name: 'stdout', max: 1024 * 1024 * 32 },
|
||||
{ name: 'stderr', max: 1024 * 1024 * 32 },
|
||||
{ name: 'stdout', max: 1024 * 1024 * size },
|
||||
{ name: 'stderr', max: 1024 * 1024 * size },
|
||||
],
|
||||
cpuLimit: time_limit_ms * 1000 * 1000,
|
||||
realCpuLimit: time_limit_ms * 3000 * 1000,
|
||||
|
||||
Reference in new issue
Block a user