mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
judge: time_rate setting
This commit is contained in:
1 parent
3fe69ca15d
commit
1b96301eef
5 files changed
+12
-5
No files matched your search
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/hydrojudge",
|
"name": "@hydrooj/hydrojudge",
|
||||||
"bin": "bin/hydrojudge.js",
|
"bin": "bin/hydrojudge.js",
|
||||||
"version": "2.8.8",
|
"version": "2.8.9",
|
||||||
"main": "package.json",
|
"main": "package.json",
|
||||||
"author": "undefined <i@undefined.moe>",
|
"author": "undefined <i@undefined.moe>",
|
||||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||||
|
|||||||
@@ -47,6 +47,11 @@ parallelism:
|
|||||||
name: parallelism
|
name: parallelism
|
||||||
desc: Runner parallelism
|
desc: Runner parallelism
|
||||||
default: 2
|
default: 2
|
||||||
|
rate:
|
||||||
|
type: number
|
||||||
|
name: rate
|
||||||
|
desc: (?)
|
||||||
|
default: 1
|
||||||
disable:
|
disable:
|
||||||
type: boolean
|
type: boolean
|
||||||
name: disable
|
name: disable
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ let config = {
|
|||||||
testcases_max: 100,
|
testcases_max: 100,
|
||||||
total_time_limit: 60,
|
total_time_limit: 60,
|
||||||
parallelism: 2,
|
parallelism: 2,
|
||||||
|
rate: 1,
|
||||||
config: null,
|
config: null,
|
||||||
langs: null,
|
langs: null,
|
||||||
env: `\
|
env: `\
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ function proc({
|
|||||||
copyOut = (copyOut as string[]).map((i) => (i.endsWith('?') ? i.substr(0, i.length - 1) : i));
|
copyOut = (copyOut as string[]).map((i) => (i.endsWith('?') ? i.substr(0, i.length - 1) : i));
|
||||||
}
|
}
|
||||||
const size = parseMemoryMB(getConfig('stdio_size'));
|
const size = parseMemoryMB(getConfig('stdio_size'));
|
||||||
|
const rate = getConfig('rate');
|
||||||
return {
|
return {
|
||||||
args: cmd(execute.replace(/\$\{dir\}/g, '/w')),
|
args: cmd(execute.replace(/\$\{dir\}/g, '/w')),
|
||||||
env: getConfig('env').split('\n'),
|
env: getConfig('env').split('\n'),
|
||||||
@@ -42,8 +43,8 @@ function proc({
|
|||||||
{ name: 'stdout', max: 1024 * 1024 * size },
|
{ name: 'stdout', max: 1024 * 1024 * size },
|
||||||
{ name: 'stderr', max: 1024 * 1024 * size },
|
{ name: 'stderr', max: 1024 * 1024 * size },
|
||||||
],
|
],
|
||||||
cpuLimit: time * 1000 * 1000,
|
cpuLimit: time * 1000 * 1000 * rate,
|
||||||
realCpuLimit: time * 3000 * 1000,
|
realCpuLimit: time * 3000 * 1000 * rate,
|
||||||
memoryLimit: memory * 1024 * 1024,
|
memoryLimit: memory * 1024 * 1024,
|
||||||
procLimit: process_limit,
|
procLimit: process_limit,
|
||||||
copyIn,
|
copyIn,
|
||||||
@@ -53,10 +54,11 @@ function proc({
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function adaptResult(result, params) {
|
async function adaptResult(result, params) {
|
||||||
|
const rate = getConfig('rate');
|
||||||
// FIXME: Signalled?
|
// FIXME: Signalled?
|
||||||
const ret: any = {
|
const ret: any = {
|
||||||
status: statusMap[result.status] || STATUS.STATUS_ACCEPTED,
|
status: statusMap[result.status] || STATUS.STATUS_ACCEPTED,
|
||||||
time_usage_ms: result.time / 1000000,
|
time_usage_ms: result.time / 1000000 / rate,
|
||||||
memory_usage_kb: result.memory / 1024,
|
memory_usage_kb: result.memory / 1024,
|
||||||
files: result.files,
|
files: result.files,
|
||||||
code: result.exitStatus,
|
code: result.exitStatus,
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ export async function load(call: Entry) {
|
|||||||
if (process.env.MINIO_ACCESS_KEY && process.env.MINIO_SECRET_KEY) {
|
if (process.env.MINIO_ACCESS_KEY && process.env.MINIO_SECRET_KEY) {
|
||||||
await modelSystem.set('file.accessKey', process.env.MINIO_ACCESS_KEY);
|
await modelSystem.set('file.accessKey', process.env.MINIO_ACCESS_KEY);
|
||||||
await modelSystem.set('file.secretKey', process.env.MINIO_SECRET_KEY);
|
await modelSystem.set('file.secretKey', process.env.MINIO_SECRET_KEY);
|
||||||
await modelSystem.set('file.endPoint', 'http://localhost:9000/');
|
|
||||||
}
|
}
|
||||||
const storage = require('../service/storage');
|
const storage = require('../service/storage');
|
||||||
await storage.start();
|
await storage.start();
|
||||||
|
|||||||
Reference in new issue
Block a user