This is a Judger for the Putong OJ platform, designed to evaluate submitted code in programming contests and algorithmic problem-solving. It works with the go-judge secure sandbox to provide a secure and efficient code execution environment.
Ensure that you have the Docker installed on your server.
Additionally, you need to have a running instance of Putong OJ.
Run the following commands to build the necessary Docker images:
docker build -t ptoj-sandbox -f Dockerfile.sandbox .
docker build -t ptoj-judger -f Dockerfile.judger .
Replace <YOUR_REDIS_URL>
and <PROBLEM_DATA_PATH>
with your actual configurations:
services:
ptoj-sandbox:
image: ptoj-sandbox
volumes:
- <PROBLEM_DATA_PATH>:/app/data:ro
privileged: true
networks:
- internal
ptoj-judger:
image: ptoj-judger
environment:
- PTOJ_REDIS_URL=<YOUR_REDIS_URL>
- PTOJ_SANDBOX_ENDPOINT=http://ptoj-sandbox:5050
networks:
- internal
networks:
internal:
driver: bridge
The following environment variables are available for configuration:
Variable | Description | Default |
---|---|---|
PTOJ_REDIS_URL |
Redis connection URL | redis://localhost:6379 |
PTOJ_SANDBOX_ENDPOINT |
Sandbox endpoint URL | http://localhost:5050 |
PTOJ_INIT_CONCURRENT |
Initial concurrent processes | 1 |
PTOJ_LOG_FILE |
Log file path | judger.log |
PTOJ_DEBUG |
Debug mode (0/1) | 1 |
Install the required dependencies:
pip install -r requirements.txt
Refer to example.py and main.py for more details on usage.
Run the following command to execute the test suite:
pip install pytest pytest-asyncio pytest-cov
pytest --cov=judger
For more details, check the tests directory.
This project is licensed under the MIT License. See the LICENSE file for more details.