mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
judge: daemon mode
This commit is contained in:
1 parent
9a58c28a91
commit
156d931811
12 files changed
+15
-15
No files matched your search
Regular → Executable
+1
-1
@@ -1,3 +1,3 @@
|
||||
#!/bin/env node
|
||||
|
||||
require('./dist/daemon')()
|
||||
require('../dist/daemon')();
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"name": "@hydrooj/hydrojudge",
|
||||
"version": "2.0.15",
|
||||
"bin": "bin/hydrojudge.js",
|
||||
"version": "2.1.0",
|
||||
"main": "package.json",
|
||||
"author": "masnn",
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable no-template-curly-in-string */
|
||||
import { STATUS } from 'hydrooj/dist/model/builtin';
|
||||
import fs from 'fs-extra';
|
||||
import * as STATUS from './status';
|
||||
import { run } from './sandbox';
|
||||
import { SystemError } from './error';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import yaml from 'js-yaml';
|
||||
import { STATUS } from 'hydrooj/dist/model/builtin';
|
||||
import * as STATUS from './status';
|
||||
import { run, del } from './sandbox';
|
||||
import { CompileError, SystemError } from './error';
|
||||
import { compilerText } from './utils';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { STATUS_TEXTS } from 'hydrooj/dist/model/builtin';
|
||||
import { STATUS_TEXTS } from './status';
|
||||
|
||||
export class CompileError extends Error {
|
||||
stdout: string;
|
||||
|
||||
@@ -2,7 +2,7 @@ import Queue from 'p-queue';
|
||||
import path from 'path';
|
||||
import fs from 'fs-extra';
|
||||
import { argv } from 'yargs';
|
||||
import { STATUS } from 'hydrooj/dist/model/builtin';
|
||||
import * as STATUS from '../status';
|
||||
import { CompileError, SystemError } from '../error';
|
||||
import { copyInDir, parseFilename } from '../utils';
|
||||
import { run } from '../sandbox';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Not implemented
|
||||
import path from 'path';
|
||||
import fs from 'fs-extra';
|
||||
import { STATUS } from 'hydrooj/dist/model/builtin';
|
||||
import * as STATUS from '../status';
|
||||
import { CompileError } from '../error';
|
||||
import { copyInDir, parseFilename } from '../utils';
|
||||
import { run } from '../sandbox';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Queue from 'p-queue';
|
||||
import fs from 'fs-extra';
|
||||
import { STATUS } from 'hydrooj/dist/model/builtin';
|
||||
import * as STATUS from '../status';
|
||||
import { parseFilename } from '../utils';
|
||||
import { run } from '../sandbox';
|
||||
import compile from '../compile';
|
||||
@@ -39,7 +39,7 @@ function judgeCase(c) {
|
||||
status = STATUS.STATUS_RUNTIME_ERROR;
|
||||
if (code < 32) message = signals[code];
|
||||
else message = `您的程序返回了 ${code}.`;
|
||||
} else [status, score, message] = resInteractor.files.stderr.split('\n');
|
||||
} else[status, score, message] = resInteractor.files.stderr.split('\n');
|
||||
ctxSubtask.score = Score[ctxSubtask.subtask.type](ctxSubtask.score, score);
|
||||
ctxSubtask.status = Math.max(ctxSubtask.status, status);
|
||||
ctx.total_time_usage_ms += time_usage_ms;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import fs from 'fs-extra';
|
||||
import path from 'path';
|
||||
import { argv } from 'yargs';
|
||||
import { STATUS } from 'hydrooj/dist/model/builtin';
|
||||
import * as STATUS from '../status';
|
||||
import { run } from '../sandbox';
|
||||
import compile from '../compile';
|
||||
import signals from '../signals';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { STATUS } from 'hydrooj/dist/model/builtin';
|
||||
import * as STATUS from '../status';
|
||||
import { check } from '../check';
|
||||
|
||||
export async function judge({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Axios from 'axios';
|
||||
import fs from 'fs-extra';
|
||||
import { STATUS } from 'hydrooj/dist/model/builtin';
|
||||
import * as STATUS from './status';
|
||||
import { SystemError } from './error';
|
||||
import { cmd } from './utils';
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import child from 'child_process';
|
||||
import fs from 'fs-extra';
|
||||
import os from 'os';
|
||||
import { Logger } from 'hydrooj/dist/logger';
|
||||
import log from './log';
|
||||
|
||||
const logger = new Logger('judge');
|
||||
const linux = os.platform() === 'linux';
|
||||
if (!linux) logger.warn('Not running on linux. tmpfs disabled.');
|
||||
if (!linux) log.warn('Not running on linux. tmpfs disabled.');
|
||||
|
||||
export function mount(path: string, size = '32m') {
|
||||
fs.ensureDirSync(path);
|
||||
|
||||
Reference in new issue
Block a user