judge: time_rate setting

This commit is contained in:
undefined committed 2021-06-16 15:44:30 +08:00
1 parent 3fe69ca15d
commit 1b96301eef
5 files changed
+12 -5

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@hydrooj/hydrojudge",
"bin": "bin/hydrojudge.js",
"version": "2.8.8",
"version": "2.8.9",
"main": "package.json",
"author": "undefined <i@undefined.moe>",
"repository": "https://github.com/hydro-dev/Hydro.git",
+5
View File
@@ -47,6 +47,11 @@ parallelism:
name: parallelism
desc: Runner parallelism
default: 2
rate:
type: number
name: rate
desc: (?)
default: 1
disable:
type: boolean
name: disable
+1
View File
@@ -19,6 +19,7 @@ let config = {
testcases_max: 100,
total_time_limit: 60,
parallelism: 2,
rate: 1,
config: null,
langs: null,
env: `\
+5 -3
View File
@@ -34,6 +34,7 @@ function proc({
copyOut = (copyOut as string[]).map((i) => (i.endsWith('?') ? i.substr(0, i.length - 1) : i));
}
const size = parseMemoryMB(getConfig('stdio_size'));
const rate = getConfig('rate');
return {
args: cmd(execute.replace(/\$\{dir\}/g, '/w')),
env: getConfig('env').split('\n'),
@@ -42,8 +43,8 @@ function proc({
{ name: 'stdout', max: 1024 * 1024 * size },
{ name: 'stderr', max: 1024 * 1024 * size },
],
cpuLimit: time * 1000 * 1000,
realCpuLimit: time * 3000 * 1000,
cpuLimit: time * 1000 * 1000 * rate,
realCpuLimit: time * 3000 * 1000 * rate,
memoryLimit: memory * 1024 * 1024,
procLimit: process_limit,
copyIn,
@@ -53,10 +54,11 @@ function proc({
}
async function adaptResult(result, params) {
const rate = getConfig('rate');
// FIXME: Signalled?
const ret: any = {
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,
files: result.files,
code: result.exitStatus,
-1
View File
@@ -56,7 +56,6 @@ export async function load(call: Entry) {
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.secretKey', process.env.MINIO_SECRET_KEY);
await modelSystem.set('file.endPoint', 'http://localhost:9000/');
}
const storage = require('../service/storage');
await storage.start();