Otter-Gradescope Debugging
Downloading a student’s graded submission concatenates the output from the autograder and a PDF copy of the student’s submitted .ipynb
. This PDF of the .ipynb
will have the output from public tests run on datahub (or wherever the student completed the assignment); it will not have the output from the autograder running in the grading container.
It is possible that the grading container may have a different environment than datahub (or wherever the student completed the assignment) if requirements.txt
is out of date. We do not recommend running student submissions locally, and it is also possible that the environment is different than whatever you may have locally.
It is also possible that a student’s submission has changed since the public tests were run on datahub. Data 100 has seen a number of cases where an indent was accidentally added to a code block, preventing a cell with a student’s answer from executing in the grading container. Consequently, those students failed tests in the grading container that they previously passed.
Open JupyterLab in the grading container
-
On Gradescope, select a specific submission to debug. Once you can view the submission, on the bottom toolbar click “Debug via SSH.” It may take a few minutes for the debugging session to initialize.
-
SSH into the grading container using the provided command from the blue box at the top of the screen with the submission. The command will look something like
ssh username@remote-host -p password
. What is printed to your terminal after SSH-ing into the grading container is useful information. Read it! -
Activate the virtual environment from
requirements.txt
in the grading container usingconda activate otter-env
. -
If
jupyterlab
was not an included requirement, runpip install jupyterlab
. You can check ifjupyterlab
was installed by runningconda list | grep jupyterlab
. -
Start JupyterLab in the grading container:
jupyter lab --no-browser --port=8888 --allow-root
. -
In a second terminal window, forward port 8888 from the grading container to your local machine:
ssh -L 8888:localhost:8888 username@remote-host -p password
using the sameusername@remote-host -p password
from Step 2. -
Access JupyterLab locally in your browser via the given link from the output from Step 4. Choose the link beginning with
http://localhost:8888/lab?token=...
Note: If you open a terminal from JupyterLab you will need to rerun conda activate otter-env
if you see (base)
on the lefthand side of the prompt.
Run the autograder on the student’s submission
-
Run otter directly with
python3 source/run_otter.py
to obtainresults/results.pkl
. -
Convert the
.pkl
file into a notebook by running the following Python snippet in theresults
directory:import dill import nbformat with open("results.pkl", "rb") as f: res = dill.load(f) nbformat.write(res.notebook, "executed.ipynb")
-
You can now inspect the output of running the autograder directly on the student’s submission by viewing
executed.ipynb
.
Interact with the student’s submission
-
Move
executed.ipynb
from theresults
directory into thesubmission
directory. This ensures you have access to any associated files and allows otter commands to run without issue. -
You may need to adjust the kernel to use the virtual environment
otter-env
.