💡
|
This plugin is in BETA version and NOT recommended to use in production websites |
readme varies in respect to version (i.e., branch), there are two available ones.
Introduction
The Online Judge plugin for Moodle is designed for courses involving programming. It can automatically grade submitted source code by testing them against customizable test cases (ACM-ICPC/Online Judge style).
1. Components
Component | Description |
---|---|
judgelib |
A local-type plugin which provides an online judge function library to any part of Moodle. |
judges |
Judge engine plugins for judgelib |
clients |
Although there is a developed user interface client, any kind of moodle plugins can work as the client of |
2. Judge Engines
Judge Engine | Description |
---|---|
Compiles and executes C/C++ programs locally in a protected environment (see libsandbox). Supports Linux 32/64-bit only. |
|
Posts all data to sphere-engine.com which compiles and executes programs remotely. Supports 40+ languages, such as C/C++, Java, Python, C#, JavaScript, Perl, PHP. Works on both Windows and Linux. |
|
Docker (under development) |
Posts all data to docker image which compilers, executes, and limiting their behavior. |
3. Plugin Client
Online Judge Assignment Feedback Plugin: online judge version of the official feedback plugin assignment activity.
The workflow is:
-
Administrators install and config it.
-
Teachers create Assignment, choose Online Judge as a feedback type, and setup testcases, etc.
-
Students submit code in Online Judge Assignment Activities.
-
The Judge Daemon judges the submissions in background.
-
Teachers and students get judge results in Online Judge Assignment Activities.
Prerequisites
1. Linux
-
Moodle
2.0
-2.7
,3.4+
-
php-cli
-
make
,gcc
andg++
. -
pcntl
andposix
extension forphp-cli
1.1. SELinux
Ensure that SELinux allows apache to execute outgoing HTTP requests through the following command:
getsebool httpd_can_network_connect
if it is not set true, run:
setsebool -P httpd_can_network_connect on
2. Windows
-
Moodle
2.0
-2.7
,3.4+
-
php-cli
Download
Using git:
git clone -b OJ_VERSION git://github.com/hit-moodle/moodle-local_onlinejudge.git onlinejudge
💡
|
OJ_VERSION is obtained from the available branches. |
Installation / Upgrading
💡
|
MOODLE_PATH means the root path of your moodle installation.
|
1. Linux
-
If the directory
MOODLE_PATH/local/onlinejudge
exists, remove/move it (because it will be automatically removed). -
Make sure the directory name of this plugin is
onlinejudge
. If not, rename it. -
Put
onlinejudge
intoMOODLE_PATH/local/
-
Run
MOODLE_PATH/local/onlinejudge/cli/install_assign_feedback
. -
Login your site as admin and access
/admin/index.php
. The plugins will be installed/upgraded. -
In shell,
sudo -u www-data php MOODLE_PATH/local/onlinejudge/cli/judged.php
, to launch the Judge Daemon.
1.1. Sandbox
If you would like to use sandbox judge engine, then run:
cd MOODLE_PATH/local/onlinejudge/judge/sandbox/sand/libsandbox && ./configure
cd ..
make
💡
|
Make sure the file named sand is executable, and has the following context: system_u:object_r:bin_t:s0 .
|
2. Windows
-
If the folder
MOODLE_PATH\local\onlinejudge
exists, remove/move it (because it will be automatically removed). -
Make sure the folder name of this plugin is
onlinejudge
. If not, rename it. -
Put
onlinejudge
intoMOODLE_PATH\local\
-
Navigate to
MOODLE_PATH\local\onlinejudge\cli
and runinstall_assign_feedback.bat
. -
Login your site as admin and access
/admin/index.php
. The plugins will be installed/upgraded. -
In command prompt, write
php.exe MOODLE_PATH\local\onlinejudge\cli\judged.php -v
, to launch the Judge Daemon.
3. Sphere Engine
In order to start using sphere engine, navigate to the following path:
MOODLE_PATH/local/onlinejudge/judge/sphere_engine/api/
and run:
composer install
💡
|
Sphere Engine accepts only one file. So, ensure that the "Maximum number of uploaded files" under "Submission types"
is equal to 1 .
|
Usage
1. Online Judge Assignment Feedback Type
After installation, there will be a new assignment feedback type called Online Judge appears in the "Feedback types" while creating the assignment. Simply check it it and follow the inline help.
After creating the assignment, two buttons will appear in the assignment page context, Test Case Management
and Rejudge All
buttons.
2. Judge Daemon
The judge daemon, which exists in cli/judged.php
, has several helpful options for debugging purposes. Use --help
argument for more information.
Links
Home |
|
FAQ |
|
Bug reports, feature requests, help wanted and other issues: |
https://github.com/hit-moodle/moodle-local_onlinejudge/issues |