Ngshare: A Solution for Using nbgrader with JupyterHub and Kubernetes

Hi, teachers and administrators who use nbgrader:

We’re team KALE, and we want to introduce to you a service we have created that lets you use nbgrader in a JupyterHub cluster.

nbgrader is a tool that facilitates creating and grading assignments in the Jupyter notebook. It allows instructors to easily create notebook-based assignments that include both coding exercises and written free-responses. nbgrader also provides a streamlined interface for quickly grading completed assignments.

nbgrader was known to use an exchange directory to release and collect assignment, submission and feedback files. nbgrader by default does not work when used in combination with JupyterHub and Kubernetes because on a Kubernetes setup users have their own private filesystem.

We have spent a couple of months creating ngshare, a service that handles course management and exchanging assignments between instructor and students without an underlying shared filesystem. It can be installed in Kubernetes easily using a helm chart. Even if you aren’t using a container orchestration platform, you can still install ngshare as a JupyterHub managed service and streamline course creation rather than having to play with filesystem permissions. Installation guides are available on Read the Docs. Any suggestions or feedback would be greatly appreciated.

Please see this video for a brief overview of our work: https://www.youtube.com/watch?v=FdK0AGwxkSw

We have also done some work on porting the nbgrader nbextensions to JupyterLab. More info is available in Github issue #1006 in the nbgrader repo. We are looking for contributors who want to take over our project.

We would like to thank Professor Christopher Nitta and Professor Jason K. Moore from UC Davis for their advice on this project. We would also like to thank the Jupyter community for their help.

Team KALE

5 Likes

Recently Otter-Grader was presented in this forum. Now I wondered: When would you consider ngshare to be the better-suiting solution?

Sorry for the late reply! ngshare is designed to be used alongside nbgrader, so it is more desirable for people already familiar with nbgrader. I only took a quick look at Otter-Grader, and it seems to be pretty different from nbgrader. I think it’s highly dependent on whether the instructor prefers nbgrader or Otter-Grader.

ngshare is designed for when students are using the same JupyterHub as their instructor. If that’s the case, students can fetch assignment files and submit them in one click using the default nbgrader interface. Otter-Grader seems to be dealing with distribution and handin using Gradescope or Canvas instead, although there is an option to have a separate server that does the grading. I think if all students and instructors in your school / organization uses the same Hub, nbgrader + ngshare is a decent choice.

There are other differences between nbgrader and Otter-Grader (such as nbgrader using a GUI (cell toolbar) to create assignments and test cases, while Otter-Grader uses a json file; nbgrader requires the instructor to grade the assignments using their Jupyter notebook server, while Otter-Grader can be setup on a headless server (otter service) that automatically grades and gives feedback, etc), but those aren’t really relevant to ngshare itself. ngshare only deals with assignment distribution and collection for nbgrader. There’s a Github issue about comparing Otter-Grader with nbgrader, and I’m sure people more familiar with both can provide a better breakdown there.

2 Likes

Thank you so much for your valuable input!

1 Like

Is it possible to use ngshare with only docker? Can I just use it as a managed-service and does ngshare also have to be on the single-user containers(DockerSpawner?

Greetings:
I am setting up Z2JH (on azure) and want to leverage ngshare. I have patched my notebooks as recommended here.

The notebooks work pretty well but the ngshare service fails with the message:

503 : Service Unavailable

Your server appears to be down. Try restarting it from the hub

When I take a look at the pods, the ngshare pod is pending for ever!
NAME READY STATUS RESTART AGE
continuous-image-puller-6krb8 1/1 Running 0 3h54m
continuous-image-puller-g9bhb 1/1 Running 0 3h54m
continuous-image-puller-xgnj8 1/1 Running 0 3h54m
hub-c57bb7c84-tvdzh 1/1 Running 0 3h54m
ngshare-665755fdbb-75pn4 0/1 Pending 0 3h20m
proxy-5cb4994b6b-8pgmt 1/1 Running 0 3h54m
user-scheduler-76b99ff776-d4g72 1/1 Running 0 3h54m
user-scheduler-76b99ff776-xzzt5 1/1 Running 0 3h54m

Running describe on the pod return the event below:
Events:
Type Reason Age From Message


Warning FailedScheduling running PreBind plugin “VolumeBinding”: binding volumes: provisioning failed for PVC “ngshare-pvc”

My interpretation is that the pod is not being scheduled, thus the lack of pvc.

NB Z2JH is being set up in azure and I am running jupyterhub chart version 0.11.1 and ngshare is version 0.5

Any advise on how to resolve this issue would be greatly appreciated.
Thank you

1 Like

Hello everyone,

I already posted this request for help in the corresponding github repo, but as I really need this, I am publishing this also here in the hope someone could help.

I gently request some help to make possible this ngshare service work with jupyterhub >= 2.0. It has been working fine while I used jupyterhub 1.3, but after upgrading jupyterhub to 2.x I get this error:

/authorizations/cookie endpoint is deprecated in JupyterHub 2.0. Use /api/user with OAuth tokens

This error appears in the kubectl logs of the jupyterhub pod when I try to access
https://mydomain.com/services/ngshare/

(the browser says “too many redirects”).

Please, any help would be very very appreciated.

Thank you.

Hello,
I just added
'admin': True
to
c.JupyterHub.services.append({
‘name’: ‘ngshare’,
‘admin’: True,
‘url’: ‘http://ngshare.labs.svc.cluster.local:8080’,
‘api_token’: ‘xxxxxxxxx’})
And now I can access to the service html page from the menu services > ngshare in jupyterhub home page.

Is there any explanation to how with this option (admin: True) is working now and it was not needed in jupyterhub 1.3? Does it has any security implications?

I still need to try if ngshare works from students side.

Thank you

I was able to run it correctly on the local machine, but when trying to host it on bare metal microk8s z2jh, I am facing the same issue. Did you have any progress on this?