judge: 支持调整stdio缓冲区大小

pull/56/head
undefined 4 years ago
parent 91f364d1b9
commit bb856bacce

@ -23,8 +23,8 @@
"@types/jest": "^26.0.20",
"@types/node": "^14.14.22",
"@types/semver": "^7.3.4",
"@typescript-eslint/eslint-plugin": "^4.14.1",
"@typescript-eslint/parser": "^4.14.1",
"@typescript-eslint/eslint-plugin": "^4.14.2",
"@typescript-eslint/parser": "^4.14.2",
"cross-spawn": "^7.0.3",
"eslint": "^7.19.0",
"eslint-config-airbnb-typescript": "^12.0.0",

@ -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,

@ -1,6 +1,6 @@
{
"name": "hydrooj",
"version": "2.17.10",
"version": "2.17.11",
"bin": "bin/hydrooj.js",
"main": "dist/loader.js",
"typings": "dist/loader.d.ts",
@ -26,14 +26,14 @@
"lru-cache": "^6.0.0",
"minio": "7.0.17",
"moment-timezone": "^0.5.32",
"mongodb": "^3.6.3",
"mongodb": "^3.6.4",
"nodemailer": "^6.4.17",
"p-queue": "^6.6.2",
"serialize-javascript": "^5.0.1",
"sockjs": "^0.3.20",
"superagent": "^6.1.0",
"systeminformation": "^5.0.8",
"terminal-kit": "^1.45.9",
"systeminformation": "^5.0.9",
"terminal-kit": "^1.47.0",
"yargs": "^16.2.0"
},
"devDependencies": {

@ -468,11 +468,12 @@ export class ProblemFilesHandler extends ProblemDetailHandler {
}
export class ProblemFileDownloadHandler extends ProblemDetailHandler {
@param('filename')
async get(domainId: string, filename: string) {
@param('filename', Types.String)
@param('noDisposition', Types.Boolean)
async get(domainId: string, filename: string, noDisposition = false) {
this.response.redirect = await storage.signDownloadLink(
`problem/${this.pdoc.domainId}/${this.pdoc.docId}/additional_file/${filename}`,
filename, false, 'user',
noDisposition ? undefined : filename, false, 'user',
);
}
}

@ -13,7 +13,7 @@
"hydrooj": "^2.15.0"
},
"dependencies": {
"ws": "^7.4.2"
"ws": "^7.4.3"
},
"devDependencies": {
"@types/ws": "^7.4.0"

@ -18,6 +18,6 @@
},
"dependencies": {
"js-yaml": "^4.0.0",
"mongodb": "^3.6.3"
"mongodb": "^3.6.4"
}
}
Loading…
Cancel
Save