Home

Awesome

Graded Jupyter Notebook Integration

Overview

Auto-grade a student assignment created as a Jupyter notebook, using the nbgrader Jupyter extension, and write the score in the Open edX gradebook

See also the Jupyter Notebook Viewer XBlock to populate course content from publicly available Jupyter notebooks.

This XBlock uses Docker and nbgrader to create a Python environment and auto-grade a Jupyter Notebook, and tracks the resulting score as a problem within an EdX graded sub-section. It allows an instructor to upload an assignment created with nbgrader, upload a requirements.txt file to configure the environment, set the maximum number of tries for the student, and set a deadline for the submission. The student downloads the assignment file, answers the questions (executing all cells), and uploads the solution, which gets immediately auto-graded. The student gets a visual score report, and the score gets added to his/her progress in the Open edX gradebook.

Features and Support

Important Notes

Efforts have been made to isolate the student notebook from the EdX Server by running them in an isolated docker container with no network access (by default). The only links back to the EdX server when the notebook is executed are the following mapped files/folders:

PLEASE REMEMBER: Jupyter Notebooks do allow arbitrary code execution

Until more granular network controls are implemented it would be best to leave network access off unless you know and trust your student population

Installation and Setup

XBlock

Docker Installation

LMS/CMS Setup

In the following two files:

Add the following to the bottom of each file:

# Jupyter Graded XBlock Endpoints
urlpatterns += (
    url(r'^api/jupyter_graded/', include('xblock_jupyter_graded.rest.urls', namespace='xblock_jupyter_graded')),
)

In the following two files:

Add the following at the bottom of the INSTALLED_APPS section:

    # Jupyter Notebook Graded XBlock
    'xblock_jupyter_graded',

Restart edxapp via /edx/bin/supervisorctl restart edxapp: Restart edxapp_worker's via /edx/bin/supervisorctl restart edxapp_worker:

Database Migration

Run the following as a root user to create the necessary database models:

sudo su edxapp -s /bin/bash
cd ~/edx-platform
source ../venvs/edxapp/bin/activate
./manage.py cms migrate xblock_jupyter_graded --settings=aws

Nginx Setup

Currently, this XBlock makes some long running Ajax calls which can exceed the default nginx timeout of 60s on some machines. We will temporarily increase this timeout until the architecture can be updated to make this a background task that can be polled for state.

In the followingfile:

Add the following line in the http section under # Basic Settings:

Restart nginx via: service nginx restart

Course Setup

Login to the EdX Studio and navigate to the course you would like to implement the XBlock in.

On the top Menu bar, select:

In the Advanced Module List, add:

Click Save at the bottom of the screen.

XBlock Organization

Studio Author View

On the main author screen in the Studio, there are three major instructor related sections:

Python Virtual Environment

Instructor Notebook Upload

Uploaded Notebook Details

XBlock Settings

Instructor Workflow

Student Workflow

Usage notes

Watch the demo!

demo

Copyright and License

(c) 2017 IBL Studios and Lorena A. Barba, code is under BSD-3 clause.

License