Skip to content
Diego A. Bayona edited this page Feb 20, 2022 · 3 revisions

Understand UNCode

This section is intended to explain in more details how the main repository of UNCode is organized, as well as how it interacts with the other components, located in other repositories in the GitHub Organization.

Introduction

The main logic of UNCode, is located in the main repository. UNCode is conformed by three main parts: frontend, backend and agent, and the main repository is in overall divided into 5 different packages located in the folder inginious/, which are going to conform the three main components. Additionally, the frontend is developed using the framework web.py.

  • common: this package contains basic classes that serve as a base for the frontend and other packages, like tasks and courses. The common does not need the backend nor the frontend, as its name indicates, the code here is common for several packages.
  • backend: in charge of handling grading requests, giving the work to distant agents; the backend is made to be simple and frontend-agnostic; you can ‘easily’ replace the frontend by something else. The backend only stores information about running tasks. This point is important when considering replication and horizontal scalability. Thus, this is in charge of managing the different agents and all the running jobs, to deliver and load balance the incoming submissions. The Backend itself can be used by multiple Clients, and dispatch jobs among Agents, which can be of different types (for now, we have two kinds of agents, DockerAgent and MCQAgent).
  • agent: this is in charge of running the jobs or submissions. It interacts directly with Docker to start new containers, and send the grades and feedback back to the backend. A specific part of the backend is in charge of starting the agents automatically; most of time, you won’t need to configure it manually. The agent needs to be run on the Docker host, as it interacts with other containers with Unix sockets, and must also interact with CGroups to allow a very fine management of timeouts and memory limits.
  • frontend: is a web interface for the backend. It provides a simple yet powerful interface for students and instructors. It is made to be “stateless”: all its state is stored in DB, allowing to replicate the frontend horizontally. Then, inside this package you will find the pages that INGInious creators have added (pages and templates directories), as well as the plugins that we have developed, adding new features.
  • client: When a student submits their code to the backend, it creates what we call a job. Jobs are sent to an object called the Client, which itself is a simple communication layer to a job queue that we call the Backend.

Architecture

The following schema shows the basic architecture of UNCode, where can be seen how the different components connect each other:

Understand UNCode

Due to the UNCode's architecture, it is possible to horizontally scale the frontend and the agents for a better performance. To understand how this is done, check the INGInious official documentation.

Plugins

As already mentioned, the plugins are a important part of the frontend because it easily allows to extend UNCode and add/modify different features. To see the current plugins that either the INGInious contributors or the UNCode team, and that are currently used, refer to the plugins page.

UNCode Containers

A grading container is a container that executes a submission and generates feedback and a grade from it. It typically runs a script, which for the case of UNCode, is created automatically by the grader generator plugin. A submission is sent to a grading container and it starts running their code against some given tests, every test runs in a sub-container, launched from the grader container, that secures the grading code avoiding the student can interact with it (sandbox). The containers, are called student containers, are started using a provided API run_student. A single grading container can launch more than one student container; the interaction between both is completely secured by the agent.

To see more about these containers, see the documentation.

Python tutor

Python Tutor helps people overcome a fundamental barrier to learning programming: understanding what happens as the computer executes each line of a program's source code. Using this tool, you can write Python, Java, JavaScript, Typescript, Ruby, C, and C++ programs in your Web browser and visualize what the computer is doing step-by-step as it executes those programs. Python tutor originally was created by Philip Guo in January 2010, we have forked their repository to add some additional features, see the Python tutor repository.

See the documentation.

Linter

We have integrated linters to the code editor on UNCode for several programming languages. A linter is a software tool that analyzes source code to flag programming errors, bugs, stylistic errors, and suspicious constructs. We are using linters for popular languages such as C/C++ (OClint), Python (Pylint) and Java (JavaPMD). Linters are useful to recommend to the students the best programming practices while they are learning. These tools help students to deal with code maintainability issues in advance. The source code is located in the repository linter-web-service.

See the documentation

Clone this wiki locally