File server for grading Jupyterhub - drhodes/remoxblock Wiki

For motivation, the following example jupyter notebook is used to help demonstrate user workflow,


image


Student Workflow

There are essentially three steps involved with the student workflow for this particular lab.

  1. define the variable q1
  2. define the variable q2
  3. RUN the "Special Grading Cell" to dump the variables q1 and q2 out to an answer file in the directory of the notebook.

(note: there may be a better approach to programing step 3) that doesn't require user intervention to create the grade file!)

Creating the answer file

The answer file is exactly that, a file that has student answers. This file is transferred back to edx for grading. If the filename of the notebook is Lab1.ipynb, then the name of the answer file will be Lab1.json. The answer file is created by dumping json out to a file, like so:

    # ...
    with open(fpath.name, 'w+') as f:
        json.dump(stored_lab_answers, f)
        print(f'>> variable {varname} is ready to grade')
    # ...

Generating that answer file is done entirely from the jupyter notebook.


image

The fileserver sits between the jupyterhub user persistent volumes and the remoxblock on the edx backend. Fileserver takes a POST request with data: (userid, answerpath).

kubernetes may need the full anonymized userid. If so, no problem! That can be included as part of the POST request or whatever else is needed.