mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
judge: update limit
This commit is contained in:
1 parent
0481876536
commit
7d1ddff47b
10 files changed
+17
-336
No files matched your search
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@hydrooj/hydrojudge",
|
||||
"bin": "bin/hydrojudge.js",
|
||||
"version": "2.1.30",
|
||||
"version": "2.1.31",
|
||||
"main": "package.json",
|
||||
"author": "masnn",
|
||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||
|
||||
@@ -87,7 +87,7 @@ async function read0(folder: string, files: string[], checkFile) {
|
||||
count: 0,
|
||||
subtasks: [{
|
||||
time_limit_ms: 1000,
|
||||
memory_limit_mb: 256,
|
||||
memory_limit_mb: 512,
|
||||
type: 'sum',
|
||||
cases: [],
|
||||
score: Math.floor(100 / cases.length),
|
||||
@@ -104,7 +104,7 @@ async function read0(folder: string, files: string[], checkFile) {
|
||||
if (extra < cases.length) {
|
||||
config.subtasks.push({
|
||||
time_limit_ms: 1000,
|
||||
memory_limit_mb: 256,
|
||||
memory_limit_mb: 512,
|
||||
type: 'sum',
|
||||
cases: [],
|
||||
score: Math.floor(100 / cases.length) + 1,
|
||||
@@ -133,7 +133,7 @@ async function read1(folder: string, files: string[], checkFile) {
|
||||
if (!subtask[REG.subtask(data)]) {
|
||||
subtask[REG.subtask(data)] = [{
|
||||
time_limit_ms: 1000,
|
||||
memory_limit_mb: 256,
|
||||
memory_limit_mb: 512,
|
||||
type: 'min',
|
||||
cases: [c],
|
||||
}];
|
||||
@@ -276,7 +276,7 @@ function convertIniConfig(ini: string) {
|
||||
cases: [{ input: `input/${input.toLowerCase()}`, output: `output/${output.toLowerCase()}` }],
|
||||
score: parseInt(score, 10),
|
||||
time: `${time}s`,
|
||||
memory: '256m',
|
||||
memory: '512m',
|
||||
};
|
||||
if (!Number.isNaN(parseInt(memory, 10))) cur.memory = `${Math.floor(parseInt(memory, 10) / 1024)}m`;
|
||||
res.subtasks.push(cur);
|
||||
|
||||
@@ -77,7 +77,7 @@ class JudgeTask {
|
||||
this.tmpdir = path.resolve(TEMP_DIR, 'tmp', this.host, this.rid);
|
||||
this.clean = [];
|
||||
fs.ensureDirSync(this.tmpdir);
|
||||
tmpfs.mount(this.tmpdir, '256m');
|
||||
tmpfs.mount(this.tmpdir, '512m');
|
||||
log.info('Submission: %s/%s/%s pid=%s', this.host, this.domainId, this.rid, this.pid);
|
||||
try {
|
||||
if (this.type === 'judge') await this.doSubmission();
|
||||
@@ -231,7 +231,7 @@ export default class Hydro {
|
||||
fs.ensureDirSync(path.dirname(savePath));
|
||||
const zip = new AdmZip(tmpFilePath);
|
||||
const entries = zip.getEntries();
|
||||
if (entries.length > 256) throw new FormatError('Too many files');
|
||||
if (entries.length > 512) throw new FormatError('Too many files');
|
||||
await new Promise((resolve, reject) => {
|
||||
zip.extractAllToAsync(savePath, true, (e) => {
|
||||
if (e) reject(e);
|
||||
|
||||
@@ -74,7 +74,7 @@ class JudgeTask {
|
||||
this.tmpdir = path.resolve(TEMP_DIR, 'tmp', this.host, this.rid);
|
||||
this.clean = [];
|
||||
fs.ensureDirSync(this.tmpdir);
|
||||
tmpfs.mount(this.tmpdir, '256m');
|
||||
tmpfs.mount(this.tmpdir, '512m');
|
||||
log.info('Submission: %s/%s/%s pid=%s', this.host, this.domain_id, this.rid, this.pid);
|
||||
try {
|
||||
if (this.type === 0) await this.doSubmission();
|
||||
@@ -256,7 +256,7 @@ export default class VJ4 {
|
||||
fs.ensureDirSync(path.dirname(savePath));
|
||||
const zip = new AdmZip(tmpFilePath);
|
||||
const entries = zip.getEntries();
|
||||
if (entries.length > 256) throw new FormatError('Too many files');
|
||||
if (entries.length > 512) throw new FormatError('Too many files');
|
||||
await new Promise((resolve, reject) => {
|
||||
zip.extractAllToAsync(savePath, true, (e) => {
|
||||
if (e) reject(e);
|
||||
@@ -286,7 +286,7 @@ export default class VJ4 {
|
||||
fs.ensureDirSync(path.dirname(savePath));
|
||||
const zip = new AdmZip(tmpFilePath);
|
||||
const entries = zip.getEntries();
|
||||
if (entries.length > 256) throw new FormatError('Too many files');
|
||||
if (entries.length > 512) throw new FormatError('Too many files');
|
||||
await new Promise((resolve, reject) => {
|
||||
zip.extractAllToAsync(savePath, true, (e) => {
|
||||
if (e) reject(e);
|
||||
|
||||
@@ -78,7 +78,7 @@ export const judge = async (ctx) => {
|
||||
copyIn: execute.copyIn,
|
||||
copyOut,
|
||||
time_limit_ms: 1000,
|
||||
memory_limit_mb: 256,
|
||||
memory_limit_mb: 512,
|
||||
},
|
||||
);
|
||||
const { code, time_usage_ms, memory_usage_kb } = res;
|
||||
@@ -90,7 +90,7 @@ export const judge = async (ctx) => {
|
||||
if (status === STATUS.STATUS_ACCEPTED) {
|
||||
if (time_usage_ms > 1000) {
|
||||
status = STATUS.STATUS_TIME_LIMIT_EXCEEDED;
|
||||
} else if (memory_usage_kb > 256 * 1024) {
|
||||
} else if (memory_usage_kb > 512 * 1024) {
|
||||
status = STATUS.STATUS_MEMORY_LIMIT_EXCEEDED;
|
||||
} else {
|
||||
[status, , message] = await check({
|
||||
|
||||
@@ -78,7 +78,7 @@ async function postInit() {
|
||||
fs.ensureDirSync(path.dirname(savePath));
|
||||
const zip = new AdmZip(tmpFilePath);
|
||||
const entries = zip.getEntries();
|
||||
if (entries.length > 256) throw new FormatError('Too many files.');
|
||||
if (entries.length > 512) throw new FormatError('Too many files.');
|
||||
await new Promise((resolve, reject) => {
|
||||
zip.extractAllToAsync(savePath, true, (e) => {
|
||||
if (e) reject(e);
|
||||
@@ -217,7 +217,7 @@ async function postInit() {
|
||||
this.tmpdir = path.resolve(tmpdir(), 'tmp', this.rid);
|
||||
this.clean = [];
|
||||
fs.ensureDirSync(this.tmpdir);
|
||||
tmpfs.mount(this.tmpdir, '256m');
|
||||
tmpfs.mount(this.tmpdir, '512m');
|
||||
logger.info(`Submission: ${this.rid}`, { pid: this.pid });
|
||||
if (this.config.input) await this.run();
|
||||
else if (this.config.hack) await this.hack();
|
||||
|
||||
Reference in new issue
Block a user