Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into beta
Browse files Browse the repository at this point in the history
  • Loading branch information
chrispyles committed Oct 25, 2024
2 parents 14ede16 + 8a946bf commit 0898cf9
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 4 deletions.
2 changes: 2 additions & 0 deletions docs/_static/grading-environment-r.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ dependencies:
- python=3.12
- pip
- nb_conda_kernels
- gcc_linux-64
- gxx_linux-64
- r-base>=4.0.0
- r-essentials
- r-devtools
Expand Down
4 changes: 2 additions & 2 deletions docs/_static/python_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ if [ $(uname -p) = "arm" ] || [ $(uname -p) = "aarch64" ] ; \
fi
chmod +x /autograder/source/mamba_install.sh
/autograder/source/mamba_install.sh -b
echo "export PATH=/root/mambaforge/bin:\$PATH" >> /root/.bashrc
echo "export PATH=/root/miniforge3/bin:\$PATH" >> /root/.bashrc

export PATH=/root/mambaforge/bin:$PATH
export PATH=/root/miniforge3/bin:$PATH
export TAR="/bin/tar"

# install dependencies with mamba
Expand Down
4 changes: 2 additions & 2 deletions docs/_static/r_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ if [ $(uname -p) = "arm" ] || [ $(uname -p) = "aarch64" ] ; \
fi
chmod +x /autograder/source/mamba_install.sh
/autograder/source/mamba_install.sh -b
echo "export PATH=/root/mambaforge/bin:\$PATH" >> /root/.bashrc
echo "export PATH=/root/miniforge3/bin:\$PATH" >> /root/.bashrc

export PATH=/root/mambaforge/bin:$PATH
export PATH=/root/miniforge3/bin:$PATH
export TAR="/bin/tar"

# install dependencies with mamba
Expand Down
48 changes: 48 additions & 0 deletions docs/debugging.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,34 @@ If you need to edit the submission file(s), they are located in the ``/autograde
directory.


Viewing the Executed Notebook
+++++++++++++++++++++++++++++

To view the notebook with its outputs from grading, you can copy the ``results.pkl`` file out from
the container and extract the notebook from it. On Gradescope, you would use SFTP to connect to the
container while it's still running and download the file ``/autograder/results/results.pkl``. For
local grading, run

.. code-block:: console
docker cp <container id>:/autograder/results/results.pkl results.pkl
to copy the file out of the container.

Once you have obtained the ``results.pkl`` file, run this Python snippet to copy the notebook out of
it.

.. code-block:: python
import dill
import nbformat
with open("results.pkl", "rb") as f:
res = dill.load(f)
nbformat.write(res.notebook, "executed.ipynb")
.. _debugging_with_otter_run:

Debugging with Otter Run
Expand All @@ -85,3 +113,23 @@ Read the :ref:`previous section <debugging_container>` first. Because Otter Run
autograder zip file for its configuration intsead of a Docker container, you will need to manually
edit the ``otter_config.json`` file in your autograder zip file to set ``"debug"`` to ``true``.
Then, re-zip the zip file's contents and use this new autograder zip file for ``otter run``.


Viewing the Executed Notebook
+++++++++++++++++++++++++++++

If you want access to the executed notebook when using Otter Run, you will need to call it from
Python instead of using the CLI. Run a script like the one below to grade the submission and obtain
the notebook.

.. code-block:: python
import nbformat
from otter.api import grade_submission
# res is the GradingResults object, so you can examine it to see the score details
res = grade_submission("submission.ipynb", ag_path="autograder.zip", debug=True)
nbformat.write(res.notebook, "executed.ipynb")
You can find details about the ``GradingResults`` class
:ref:`here <workflow_executing_submissions_otter_run_grading_results>`.
2 changes: 2 additions & 0 deletions docs/workflow/executing_submissions/otter_run.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ console by the grading process during execution when set to ``True`` (default ``
For more information about grading programmatically, see the :ref:`API reference <api_reference>`.


.. _workflow_executing_submissions_otter_run_grading_results:

Grading Results
+++++++++++++++

Expand Down

0 comments on commit 0898cf9

Please sign in to comment.