Skip to content

API for connecting with the DMOJ Judge used for grading programming exercises in the Minerva Learning Management System (LMS). Developed by a group of students of UNAL using Flask.

Notifications You must be signed in to change notification settings

MinervaLMS/judge-api

Repository files navigation

Contributors Forks Stargazers Issues


Judge API - Minerva

API for connecting with the DMOJ Judge used for grading programming exercises in the Minerva LMS.
Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Contributing
  4. License
  5. Contact

About The Project

This API is employed to establish a seamless connection between the Minerva backend and the judge, with a focus on efficiently handling requests.

Here's why:

  • The project anticipates approximately 200,000 requests per year, with specific instances requiring a high volume of service consumption.
  • The judge needs to effectively handle multiple requests simultaneously.

(back to top)

Built With

Are you able to review our requirements outlined in the pyproject file. This document provides a comprehensive overview of the specifications we are seeking.

  • Flask

(back to top)

Getting Started

Here's a guide on how to set up our project locally. This step-by-step walkthrough will assist you in configuring the project on your local environment for seamless development and testing.

Prerequisites

In order to effectively work with this project, it's necessary to install certain software components. Follow these steps:

  • Ensure you have Python 3.X installed, with the appropriate version specified in pyproject

    sudo apt install python3.8

Nice to have:

  • Consider adding an SSH key for seamless connection with GitHub. This small step can greatly enhance your experience by simplifying authentication processes and streamlining your interactions with the platform. Look this tutorial if you want

Installation

  1. Clone the repo
    git clone https://github.com/MinervaLMS/judge-api.git
  2. Install poetry
    curl -sSL https://install.python-poetry.org | python3 -
    For a proper installation on your operating system, we recommend following this tutorial
  3. Initialize the Poetry environment by navigating to the correct project path and executing the command below:
    poetry shell
    • This installs the default Python version on your computer for the environment. If you prefer to use a different version, you can install that version on your computer and then proceed with the following steps:
          poetry env use 3.8
  4. Install the required dependencies by running the following command:
        poetry install
    • If you stumble upon an DMOJ error related to library $seccomp$, run the following command on you linux machine:
          sudo apt install libseccomp-dev
    • Another usual problem is related to 'x86_64-linux-gnu-gcc'. To solve it, install:
          sudo apt-get install build-essential
  5. We recommend configuring the pre-commit functionality within the Poetry environment, especially if you won't be using it in other repositories. However, you also have the option to set it up globally on your PC by installing pre-commit system-wide.
     pre-commit install
  6. The default DMOJ root is $/mnt$. We must give permissions to a group in order to place and modify archives located there. As we desire not other users modifing our environment, first, let's create a group named judge:
     sudo groupadd judge

And add user ubuntu to group judge:

 sudo usermod --append --groups judge ubuntu

To set permissions, we must change ownership of /mnt to be group judge:

 sudo chown :judge mnt

Finally, we set permissions. We will set it so that both root and group judge have rwx (read, write, execute) permissions and other users none.

 sudo chmod 770 /mnt

A final reminder is that one must logout and login again for these changes to apply.

  1. To run the Judge API, run the following command, which can be understood as following: The --http option starts an HTTP server at 0.0.0.0 port 5000. The --master option specifies the standard worker manager. The $-p$ option starts 4 worker processes; a starting value could be $CPU * 2$. The $-w$ option tells uWSGI how to import your application (ref). The $ & $ value will let you operate your machine while the Judge API is running.
     nohup uwsgi --http 0.0.0.0:5000 --master -p 4 -w wsgi:app &
    • If you require to terminate this process, run the following command (supposing you are running the API in the 5000 port as default).
          kill -9 $(lsof -t -i:"5000")

Config Judge DMOJ

NOTE: It is intended for Linux-based machines (WSL included); Windows and mac are not supported.

  1. in the poetry environment run the command
     dmoj-autoconf 
    
    copy and paste the output into judge-api/app/utils/constants.py RUNTIME

finally verify that in the path of judge-api/app/utils/constants.py JUDGE_ROOT there is the folder problems with the problem TEST inside

(back to top)

Contributing

If you want to contribute in this project

  1. Clone the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

Your Name - @your_twitter - email@example.com

Project Link: https://github.com/MinervaLMS/judge-api/

(back to top)

About

API for connecting with the DMOJ Judge used for grading programming exercises in the Minerva Learning Management System (LMS). Developed by a group of students of UNAL using Flask.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages