Getting new version of nbgrader to work with JupyterHub

218 views
Skip to first unread message

Kristen Thyng

unread,
Aug 28, 2017, 4:36:06 PM8/28/17
to Teaching with Jupyter Notebooks
Hi,

I know that nbgrader is supposed to be really easy to use now, but I am still managing to have trouble! I think I'm bumbling through and managing many of the steps, including getting formgrader to find an nbgrader_config.py file. However, it is assuming that my home directory is where it should look for all files, and I can't get it to look for more than one nbgrader_config.py file. I know that having multiple classes is a bit tricky, but I did it successfully last fall. I have the following line in my nbgrader_config.py file:

c.Exchange.path_includes_course = True

which it says to do here: http://nbgrader.readthedocs.io/en/stable/user_guide/faq.html#id16, but this doesn't seem to have made a difference. I have a class directory in my home directory with an nbgrader_config.py file, which I have then simlinked into my .jupyter directory. When I use formgrader and ask it to make and then generate a new assignment (so I can see where it puts files), it makes a gradebook.db file in my home directory, and then tries to make a source directory but fails with a permissions error.

Any thoughts on this?

Thanks for your help,
Kristen

Kristen Thyng

unread,
Aug 29, 2017, 6:45:06 PM8/29/17
to Teaching with Jupyter Notebooks
Ok so getting the formgrader to assume a different class path was as simple as editing the course location in my nbgrader_config.py file, for the following line: c.CourseDirectory.root.

The main problem now is that I can't figure out how to use formgrader with two classes. I think I need to set this up in the workstation's jupyterhub_config.py file under "services" but I am having trouble finding any detailed help on how to do this for formgrader exactly. Does this mean I need to set up an authentication token? I had to do this a year ago when I taught, but now it looks like this isn't happening with the nbgrader changes.

I'm also unclear why jupyterhub is looking for the course nbgrader_config.py file in my local .jupyter directory (among a few other places) instead of in my actual course directory. I am not sure how it would know to look there in particular, but in seemed to do so in the past! And how will it recognize two different course nbgrader_config.py files if I can get the jupyterhub_config.py file fixed?

Thanks for any help,
Kristen

Doug Blank

unread,
Aug 30, 2017, 8:06:08 PM8/30/17
to Kristen Thyng, Teaching with Jupyter Notebooks
On Tue, Aug 29, 2017 at 6:45 PM, Kristen Thyng <kth...@gmail.com> wrote:
Ok so getting the formgrader to assume a different class path was as simple as editing the course location in my nbgrader_config.py file, for the following line: c.CourseDirectory.root.

The main problem now is that I can't figure out how to use formgrader with two classes. I think I need to set this up in the workstation's jupyterhub_config.py file under "services" but I am having trouble finding any detailed help on how to do this for formgrader exactly. Does this mean I need to set up an authentication token? I had to do this a year ago when I taught, but now it looks like this isn't happening with the nbgrader changes.

I *think* I have this figured out. I too am on jupyterhub, all local accounts. Trying to use the new, fancy, very nice GUI features.

Some points I think I understand:

1) The docs don't say it, but you need at least two nbgrader_config.py files: one in your home root that points to the current course, like:

c.CourseDirectory.root = "CS110"

2) To get this to be activated, I had to shutdown my server (under admin) restart it, and reload the formgrader.

3) To change to a different course, I edit the root nbgrader_config.py:

c.CourseDirectory.root = "CS240"

restart my server, and reload the formgrader.

This looks good from the students perspective, but not so good from the instructor. For example, I can't tell what class I am looking at in the formgrader.

Does that help? Now, I need to check to see if I can release, collect, grade, and return...

-Doug
 

I'm also unclear why jupyterhub is looking for the course nbgrader_config.py file in my local .jupyter directory (among a few other places) instead of in my actual course directory. I am not sure how it would know to look there in particular, but in seemed to do so in the past! And how will it recognize two different course nbgrader_config.py files if I can get the jupyterhub_config.py file fixed?

Thanks for any help,
Kristen


On Monday, August 28, 2017 at 3:36:06 PM UTC-5, Kristen Thyng wrote:
Hi,

I know that nbgrader is supposed to be really easy to use now, but I am still managing to have trouble! I think I'm bumbling through and managing many of the steps, including getting formgrader to find an nbgrader_config.py file. However, it is assuming that my home directory is where it should look for all files, and I can't get it to look for more than one nbgrader_config.py file. I know that having multiple classes is a bit tricky, but I did it successfully last fall. I have the following line in my nbgrader_config.py file:

c.Exchange.path_includes_course = True

which it says to do here: http://nbgrader.readthedocs.io/en/stable/user_guide/faq.html#id16, but this doesn't seem to have made a difference. I have a class directory in my home directory with an nbgrader_config.py file, which I have then simlinked into my .jupyter directory. When I use formgrader and ask it to make and then generate a new assignment (so I can see where it puts files), it makes a gradebook.db file in my home directory, and then tries to make a source directory but fails with a permissions error.

Any thoughts on this?

Thanks for your help,
Kristen

--
You received this message because you are subscribed to the Google Groups "Teaching with Jupyter Notebooks" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter-education+unsubscribe@googlegroups.com.
To post to this group, send email to jupyter-education@googlegroups.com.
Visit this group at https://groups.google.com/group/jupyter-education.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter-education/dcc6df77-833c-4684-81d1-a42ae9294e03%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Doug Blank

unread,
Aug 30, 2017, 8:21:18 PM8/30/17
to Teaching with Jupyter Notebooks
On Wednesday, August 30, 2017 at 8:06:08 PM UTC-4, Doug Blank wrote:
On Tue, Aug 29, 2017 at 6:45 PM, Kristen Thyng <kth...@gmail.com> wrote:
Ok so getting the formgrader to assume a different class path was as simple as editing the course location in my nbgrader_config.py file, for the following line: c.CourseDirectory.root.

The main problem now is that I can't figure out how to use formgrader with two classes. I think I need to set this up in the workstation's jupyterhub_config.py file under "services" but I am having trouble finding any detailed help on how to do this for formgrader exactly. Does this mean I need to set up an authentication token? I had to do this a year ago when I taught, but now it looks like this isn't happening with the nbgrader changes.

I *think* I have this figured out. I too am on jupyterhub, all local accounts. Trying to use the new, fancy, very nice GUI features.

Some points I think I understand:

1) The docs don't say it, but you need at least two nbgrader_config.py files: one in your home root that points to the current course, like:

c.CourseDirectory.root = "CS110"

I think I ended up required to use the full path:

c.CourseDirectory.root = "/home/dblank/CS110" 

as well. I now have released two assignments from two classes, but they are getting confused. I can select each course (CS110/CS240) but it will only let me fetch one version. I think I need to include the course_id in the name of the assignment. Not much documentation/examples to go on here, though.

-Doug

Doug Blank

unread,
Aug 30, 2017, 8:36:49 PM8/30/17
to Teaching with Jupyter Notebooks
On Wed, Aug 30, 2017 at 8:21 PM, Doug Blank <doug....@gmail.com> wrote:
On Wednesday, August 30, 2017 at 8:06:08 PM UTC-4, Doug Blank wrote:
On Tue, Aug 29, 2017 at 6:45 PM, Kristen Thyng <kth...@gmail.com> wrote:
Ok so getting the formgrader to assume a different class path was as simple as editing the course location in my nbgrader_config.py file, for the following line: c.CourseDirectory.root.

The main problem now is that I can't figure out how to use formgrader with two classes. I think I need to set this up in the workstation's jupyterhub_config.py file under "services" but I am having trouble finding any detailed help on how to do this for formgrader exactly. Does this mean I need to set up an authentication token? I had to do this a year ago when I taught, but now it looks like this isn't happening with the nbgrader changes.

I *think* I have this figured out. I too am on jupyterhub, all local accounts. Trying to use the new, fancy, very nice GUI features.

Some points I think I understand:

1) The docs don't say it, but you need at least two nbgrader_config.py files: one in your home root that points to the current course, like:

c.CourseDirectory.root = "CS110"

I think I ended up required to use the full path:

c.CourseDirectory.root = "/home/dblank/CS110" 

as well. I now have released two assignments from two classes, but they are getting confused. I can select each course (CS110/CS240) but it will only let me fetch one version. I think I need to include the course_id in the name of the assignment. Not much documentation/examples to go on here, though.

Success! Yes, I had to use the assignment names CS110-Lab1 and CS240-Lab1 in order that they not get confused. And (as a bonus) I can now tell what course I am looking at in the form grader. I was able to release, fetch, submit, collect, and grade. (It took me a minute to figure out you had to click on the number of submissions to autograde them).

Now I have to see what the new modern ways for returning the graded assignments are...
 

Kristen Thyng

unread,
Aug 31, 2017, 2:08:47 PM8/31/17
to Teaching with Jupyter Notebooks
Hi Doug and all,

Thanks for adding your experience here. 

I ended up using the straight-forward approach suggested by @yao2001626 in an issue I opened on github: https://github.com/jupyter/nbgrader/issues/881

So, that is, I created a second username for myself and I am controlling one class in my normal user account and the second class in my new user account. I just sign out of one and into the other to use formgrader for each respective class.

It's pretty similar to what you are doing, in the end.

Kristen

-Doug

To unsubscribe from this group and stop receiving emails from it, send an email to jupyter-educat...@googlegroups.com.
To post to this group, send email to jupyter-...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Teaching with Jupyter Notebooks" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter-educat...@googlegroups.com.
To post to this group, send email to jupyter-...@googlegroups.com.

Kristen Thyng

unread,
Aug 31, 2017, 6:22:24 PM8/31/17
to Teaching with Jupyter Notebooks
For reference, here are the steps I followed to get a reasonable enough solution for my classes this term. course-id == 2017f-ocng669.

Class #1:
  1. go to /home/kthyng/classes/ and type `nbgrader quickstart 2017f-ocng669` to get framework of class
  2. put a symlink from /home/kthyng/classes/2017f-ocng669/nbgrader_config.py in /home/kthyng/.jupyter
  3. edit nbgrader_config.py in class dir:
    1. already should be set: c.Exchange.course_id = "2017f-ocng669”
    2. update a student to be pythontest for testing
    3. c.CourseDirectory.root = '/home/kthyng/classes/2017f-ocng669’
  4. Should be able to now generate and release hw, etc. 
    1. assignments do not need the name of the class in them anymore
Then made a new user account on the machine and did the same process with the other course.

*******NOTE:
I luckily ran across a note in one of the change logs about needing to update the meta data in the homework notebooks. I did this with 
`nbgrader update` and it was easy EXCEPT I had with my old homework copied in the old header.ipynb notebook and it took me quite awhile to figure out that was the problem. I got the new version back and put it in, though I think just running the nbgrader update on that notebook too would have worked fine.


Hope that helps someone!
Kristen

Kristen Thyng

unread,
Sep 5, 2017, 1:57:27 PM9/5/17
to Teaching with Jupyter Notebooks
One more note: it is false that the assignments don't need the class name in them anymore! Still need that to distinguish classes!

Loïc Gouarin

unread,
Sep 5, 2017, 7:35:14 PM9/5/17
to Teaching with Jupyter Notebooks
Hi Kristen,

I try to use formgrader too but it doesn't work. It seems that you have found a solution.

Did you modify your jupyterhub_config.py ?

Could you tell me if you have added other informations in your nbgrader_config.py than the root directory ?

I have tried your steps but nothing happen for me ...

Thanks,
Loic

Kristen Thyng

unread,
Sep 5, 2017, 9:40:21 PM9/5/17
to Loïc Gouarin, Teaching with Jupyter Notebooks
Hi Loic,

I modified jupyterhub_config.py to add myself to the admin list, but otherwise no.


Here are all the active lines in my nbgrader_config.py:


c = get_config()
c.Exchange.course_id = "2017f-ocng669"
c.CourseDirectory.db_assignments = [dict(name="ps1")]
c.CourseDirectory.db_students = [
    dict(id="pythontest", first_name="python", last_name="test"),
    etc)
]
c.IncludeHeaderFooter.header = "source/header.ipynb"
c.CourseDirectory.root = '/home/kthyng/classes/2017f-ocng669'


I have this in my course directory, but I also have it in a .jupyter directory in my home directory (symlinked), which was key for formgrader recognizing the course itself since it isn't sitting in my home directory.

Kristen

--
You received this message because you are subscribed to a topic in the Google Groups "Teaching with Jupyter Notebooks" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jupyter-education/hlAoxdic6xk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jupyter-education+unsubscribe@googlegroups.com.
To post to this group, send email to jupyter-education@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Kristen M. Thyng
Assistant Research Professor
Department of Oceanography
Texas A&M University

Loïc Gouarin

unread,
Sep 6, 2017, 2:54:10 AM9/6/17
to Kristen Thyng, Teaching with Jupyter Notebooks
So I do exactly the same but it doesn't work for me ...

Thanks Kristen.


Loïc Gouarin

unread,
Sep 6, 2017, 5:47:06 AM9/6/17
to Teaching with Jupyter Notebooks
After restarting JupyterHub, it works. That is to say that a user can't add a course without an admin or we have to add a cron to restart JupyterHub.

Doug Blank

unread,
Sep 6, 2017, 6:23:53 AM9/6/17
to Teaching with Jupyter Notebooks
On Wednesday, September 6, 2017 at 5:47:06 AM UTC-4, Loïc Gouarin wrote:
After restarting JupyterHub, it works. That is to say that a user can't add a course without an admin or we have to add a cron to restart JupyterHub.

You don't have to restart all of jupyterhub, just the instructor's server. They can do that via Control Panel -> Stop Server, Start Server.

I have a similar setup to Kristen's, except my top-level nbgrader_config root just point to the course, and then have the course ngbrader_config with the rest of the details.

-Doug
 
To unsubscribe from this group and all its topics, send an email to jupyter-educat...@googlegroups.com.

To post to this group, send email to jupyter-...@googlegroups.com.
Visit this group at https://groups.google.com/group/jupyter-education.

Jessica B. Hamrick

unread,
Oct 18, 2017, 3:26:39 PM10/18/17
to Doug Blank, Teaching with Jupyter Notebooks
[Catching up on email as I've been away for the last two months]

I mentioned this on the nbgrader repo but thought I'd send a note here too---apologies that it is so confusing to get the formgrader set up especially with multiple classes! I'll try to write up some documentation that covers various case studies of how people would like to set it up that will hopefully be useful going forward.

Cheers,
Jess


To unsubscribe from this group and stop receiving emails from it, send an email to jupyter-education+unsubscribe@googlegroups.com.
To post to this group, send email to jupyter-education@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages