Programmatic assignment handling

Outcome You collect, grade, and hand back assignments at the command line using nvcollect, integrated with otter-grader.

Before you start

  • You have access to a JupyterLab + TeX Live application.

  • otter-grader and pandoc are available in the application (TeX Live is available on request from Nuvolos support).

  • You have installed nvcollect (contact support for the current install command).

  • You are working in the Master Instance.

To install nvcollect, run the following command from the terminal in your JupyterLab application:

pip install --upgrade git+https://github.com/alphacruncher/nv-collect

nvcollect is a command-line tool available in supported applications. It lets you:

  • Collect assignments from all students into a folder in your instance.

  • Grade assignments with the otter-grader package.

  • Hand back assignments to all students in one command.

Otter Grader integration

Below is a complete pipeline integrating nvcollect with otter-grader. It assumes you have already set up a JupyterLab application with otter-grader, pandoc, and TeX Live.

1

Obtain the Otter tutorial files

In a JupyterLab terminal, download the Otter Grader tutorial files. Refer to the otter-grader documentation for the current download command.

2

Modify demo.ipynb for headless use

The Otter Grader demo.ipynb assumes a windowed environment, which is not available on Nuvolos. In the second cell, replace the windowed call with the headless equivalent:

%matplotlib inline

Make sure to have:

import matplotlib
matplotlib.use('Agg')
3

Run otter assign

In the directory where you extracted the tutorial archive, run:

otter assign demo.ipynb dist --v1

This creates a dist/ directory containing autograding artefacts and the student-facing assignment file at dist/student/demo.ipynb.

4

Create the assignment on Nuvolos

Copy dist/student/demo.ipynb to a clean folder under /files, then stage and distribute it as an Assignment (see Creating an assignment above). For example, copy from /files/otter-test/dist/student/demo.ipynb to /files/assignment_1/demo.ipynb, stage /files/assignment_1/, and create an assignment named 'assignment_1'.

Keeping the assignment name in Nuvolos the same as the folder name (assignment_1) is a useful convention - it is not required, but it makes the nvcollect command much easier to remember.

5

Collect hand-ins

Once the deadline has passed, collect submissions:

nvcollect collect \
  --assignment_name "assignment_1" \
  --assignment_folder assignment_1 \
  --target_folder /files/test_collect

This gathers everything in the assignment_1 folder of the assignment_1 assignment from all students into /files/test_collect/. The directory structure is:

/files/test_collect
+-- nvcollect_manifest.json
+-- single_user_inst_<code1>
|   +-- ...
+-- single_user_inst_<code2>
|   +-- ...
6

Grade hand-ins

Run autograding across all collected submissions:

nvcollect otter-grade \
  --source_folder /files/test_collect \
  --autograder_location /files/otter-test/dist/autograder/autograder.zip \
  --relative_path demo.ipynb

Three notes:

  • source_folder is the same as the target_folder from the collect command.

  • autograder_location is the absolute path to the autograder zip from step 3.

  • relative_path tells the tool where to look inside each student folder for the notebook to grade.

After grading, source_folder contains:

  • A grade.csv file at the top level with the score of each student.

  • A grade.csv file inside each student folder with that student's score.

7

Hand back the results

Optionally add additional artefacts to each student folder (manually or programmatically), then push results back to students:

nvcollect handback --source_folder /files/test_collect

source_folder here is the same folder where collection and grading happened.

Last updated

Was this helpful?