How vnoi-admin/judge-server works
Main Components
• Judge Server Core – This is the heart of the project (look at files like dmoj/main.py, dmoj/judge.py, dmoj/control.py). It manages connections to the submission server (DMOJ site interface), submission dispatching, and overall judge behavior.
• Executor Layer – Under dmoj/executors, you have numerous language-specific executors (e.g. for C/C++, Java, Python, etc.) that compile, execute, and sandbox each submission. Also note the common logic (base_executor.py, script_executor.py, etc.) and mixins.
• Checker/Grader Module – Modules in dmoj/checkers and dmoj/graders provide support for comparing outputs, processing interactive tasks, and handling signature-graded submissions.
• Sandbox/Isolation Component – The dmoj/cptbox directory contains several C/C++ components that interface with system-level functions to strictly isolate the judging process, ensuring secure sandboxed execution.
• Configuration & CLI Tools – The existence of the “dmoj” and “dmoj-cli” executables, complemented by configuration (config.py) and command dispatchers (dmoj/commands), show that the project also supports both full server operation and local testing.
• Docker & Deployment – The .docker directories (including tier1, tier2, etc.) hint at Docker images and scripted deployment. Use these to represent the external containerized environments that provide runtime isolation and preconfigured runtime environments.
Relationships & Interactions
• Data Flow: Clearly indicate that submissions flow from the online judge (DMOJ site) into the Judge Server.
• The Judge Server receives a submission, selects the appropriate executor based on language (via its executors module), and triggers the sandbox isolation (via cptbox) to compile/run submissions inside a secure environment.
• Once execution is complete, the output is validated by the checker and grading modules.
• Finally, the result (pass/fail, runtime errors, etc.) is reported back to the online judging server via API or CLI interfaces.
• For local testing or administrative tasks, the dmoj-cli acts as a simplified front-end, yet still relies on many of the same internal modules.
Architectural Patterns & Design Principles
• Security & Isolation Layer: Emphasize the sandboxing approach using both Docker (as deployment and runtime isolation) and system-level sandbox mechanisms (via cptbox).
• Command Pattern & CLI Utilities: Separate CLI utilities (dmoj-cli) from the main server function.
• Testing and Continuous Integration: The extensive testsuite and the CI/CD configuration (GitHub workflows, FreeBSD and Linux builds) indicate that automated tests and validation are key in this system.
Relevant Technologies
• Python is used for the core server, CLI, and many modules.
• C/C++ components for low-level system isolation and performance (cptbox, checkers in C/C++).
• Docker is used for containerized runtime environments (with multiple “tier” Dockerfiles).
• Various scripting languages and build/test configurations (Makefiles, GitHub workflows, etc.) support CI/CD.