项目作者: DMOJ

项目描述 :
一个现代的,开源的在线评判和竞赛平台系统。
高级语言: Python
项目地址: git://github.com/DMOJ/judge.git
创建时间: 2014-03-14T15:14:10Z
项目社区:https://github.com/DMOJ/judge

开源协议:GNU Affero General Public License v3.0

下载






DMOJ Judge



Linux Build Status


FreeBSD Build Status


Coverage


License




Contest judge backend for the DMOJ site interface, supporting IO-based, interactive, and signature-graded tasks, with runtime data generators and custom output validators.

See it in action at dmoj.ca!

Supported platforms and runtimes

The judge implements secure grading on Linux and FreeBSD machines.

Linux FreeBSD
x64
x86 ¯\_(ツ)_/¯
x32
ARM

Versions up to and including v1.4.0 also supported grading on Windows machines.

Versions up to and including v3.0.2 also supported grading
with pure ptrace without seccomp, which is useful on Linux kernel versions before 4.8.

The DMOJ judge does not need a root user to run on Linux machines: it will run just fine under a normal user.

Supported languages include:

  • C++ 11/14/17/20 (GCC and Clang)
  • C 99/11
  • Java 8-19
  • Python 2/3
  • PyPy 2/3
  • Pascal
  • Mono C#/F#/VB

The judge can also grade in the languages listed below:

  • Ada
  • Algol 68
  • AWK
  • Brain****
  • COBOL
  • D
  • Dart
  • Forth
  • Fortran
  • Go
  • Groovy
  • Haskell
  • INTERCAL
  • JavaScript (Node.js and V8)
  • Kotlin
  • Lean 4
  • LLVM IR
  • Lua
  • NASM
  • Objective-C
  • OCaml
  • Perl
  • PHP
  • Pike
  • Prolog
  • Racket
  • Ruby
  • Rust
  • Scala
  • Chicken Scheme
  • sed
  • Steel Bank Common Lisp
  • Swift
  • Tcl
  • Turing
  • V8 JavaScript
  • Zig

Installation

Installing the DMOJ judge creates two executables in your Python’s script directory: dmoj and dmoj-cli.
dmoj is used to connect a judge to a DMOJ site instance, while dmoj-cli provides a command-line interface to a
local judge, useful for testing problems.

For more detailed steps, read the installation instructions.

Note that the only Linux distribution with first-class support is the latest Debian, with the default apt versions of all runtimes. This is what we run on dmoj.ca, and it should “just work”. While the judge will likely still work with other distributions and runtime versions, some runtimes might fail to initialize. In these cases, please file an issue.

Stable build

PyPI version
PyPI

We periodically publish builds on PyPI. This is the easiest way to get started,
but may not contain all the latest features and improvements.

  1. $ pip install dmoj

Bleeding-edge build

This is the version of the codebase we run live on dmoj.ca.

  1. $ git clone --recursive https://github.com/DMOJ/judge-server.git
  2. $ cd judge-server
  3. $ pip install -e .

Several environment variables can be specified to control the compilation of the sandbox:

  • DMOJ_TARGET_ARCH; use it to override the default architecture specified for compiling the sandbox (via -march).
    Usually this is native, but will not be specified on ARM unless DMOJ_TARGET_ARCH is set (a generic, slow build will be compiled instead).

With Docker

We maintain Docker images with all runtimes we support in the runtimes-docker project.

Runtimes are split into three tiers of decreasing support. Tier 1 includes
Python 2/3, C/C++ (GCC only), Java 8, and Pascal. Tier 3 contains all the
runtimes we run on dmoj.ca. Tier 2 contains some in-between
mix; read the Dockerfile for each tier for details. These images are rebuilt
and tested every week to contain the latest runtime versions.

The script below spawns a tier 1 judge image. It expects the relevant
environment variables to be set, the network device to be enp1s0, problems
to be placed under /mnt/problems, and judge-specific configuration to be in
/mnt/problems/judge.yml. Note that runtime configuration is already done for you,
and will be merged automatically into the judge.yml provided.

  1. $ git clone --recursive https://github.com/DMOJ/judge-server.git
  2. $ cd judge-server/.docker
  3. $ make judge-tier1
  4. $ exec docker run \
  5. --name judge \
  6. -p "$(ip addr show dev enp1s0 | perl -ne 'm@inet (.*)/.*@ and print$1 and exit')":9998:9998 \
  7. -v /mnt/problems:/problems \
  8. --cap-add=SYS_PTRACE \
  9. -d \
  10. --restart=always \
  11. dmoj/judge-tier1:latest \
  12. run -p15001 -s -c /problems/judge.yml \
  13. "$BRIDGE_ADDRESS" "$JUDGE_NAME" "$JUDGE_KEY"

Usage

Running a judge server

  1. $ dmoj --help
  2. usage: dmoj [-h] [-p SERVER_PORT] -c CONFIG [-l LOG_FILE] [--no-watchdog]
  3. [-a API_PORT] [-A API_HOST] [-s] [-k] [-T TRUSTED_CERTIFICATES]
  4. [-e ONLY_EXECUTORS | -x EXCLUDE_EXECUTORS] [--no-ansi]
  5. server_host [judge_name] [judge_key]
  6. Spawns a judge for a submission server.
  7. positional arguments:
  8. server_host host to connect for the server
  9. judge_name judge name (overrides configuration)
  10. judge_key judge key (overrides configuration)
  11. optional arguments:
  12. -h, --help show this help message and exit
  13. -p SERVER_PORT, --server-port SERVER_PORT
  14. port to connect for the server
  15. -c CONFIG, --config CONFIG
  16. file to load judge configurations from
  17. -l LOG_FILE, --log-file LOG_FILE
  18. log file to use
  19. --no-watchdog disable use of watchdog on problem directories
  20. -a API_PORT, --api-port API_PORT
  21. port to listen for the judge API (do not expose to
  22. public, security is left as an exercise for the
  23. reverse proxy)
  24. -A API_HOST, --api-host API_HOST
  25. IPv4 address to listen for judge API
  26. -s, --secure connect to server via TLS
  27. -k, --no-certificate-check
  28. do not check TLS certificate
  29. -T TRUSTED_CERTIFICATES, --trusted-certificates TRUSTED_CERTIFICATES
  30. use trusted certificate file instead of system
  31. -e ONLY_EXECUTORS, --only-executors ONLY_EXECUTORS
  32. only listed executors will be loaded (comma-separated)
  33. -x EXCLUDE_EXECUTORS, --exclude-executors EXCLUDE_EXECUTORS
  34. prevent listed executors from loading (comma-
  35. separated)
  36. --no-ansi disable ANSI output
  37. --skip-self-test skip executor self-tests

Running a CLI judge

  1. $ dmoj-cli --help
  2. usage: dmoj-cli [-h] -c CONFIG
  3. [-e ONLY_EXECUTORS | -x EXCLUDE_EXECUTORS]
  4. [--no-ansi]
  5. Spawns a judge for a submission server.
  6. optional arguments:
  7. -h, --help show this help message and exit
  8. -c CONFIG, --config CONFIG
  9. file to load judge configurations from
  10. -e ONLY_EXECUTORS, --only-executors ONLY_EXECUTORS
  11. only listed executors will be loaded (comma-separated)
  12. -x EXCLUDE_EXECUTORS, --exclude-executors EXCLUDE_EXECUTORS
  13. prevent listed executors from loading (comma-
  14. separated)
  15. --no-ansi disable ANSI output
  16. --skip-self-test skip executor self-tests

Documentation

For info on the problem file format and more, read the documentation.