nbgrader
nbgrader copied to clipboard
Formgrader says to run the autograde command from the wrong folder
I created an assignment entirely using the formgrader interface (in the browser). I successfully grade a handful of students by clicking on the lightning bolt icon under the "Autograde" column. But I don't want to click each one individually so I try the command line version, running the commands suggested at the top of the page:
cd "/mnt/classdat/psy360"
nbgrader autograde "ps0"
This initially gives me an error saying the assignment is not in the database. I add it with nbgrader db assignment add ps0 --duedate="2019-9-27 20:30:00 UCT" and try rerunning autograde. Now it gives me the error No notebooks found, did you forget to run 'nbgrader generate_assignment'?
I'm not sure what to do now. I'm worried that generate_assignment will overwrite the assignment that I generated (and released) earlier using the formgrader interface. It is very odd to me that the GUI interface would work but the command line interface would throw errors. Shouldn't these be ultimately be calling the same backend functions?
To give more information, I think the issue is that the notebooks were not registered with the database when I generated the assignment using the web interface. Is there anyway I can manually add notebooks to the database (or even just look at it to see if that's really the problem).
Hmm, it's possible the command that's listed on the formgrader page is having you go to the wrong directory---it should work just as well from the command line or from the formgrader. Could you share more details of your setup and your nbgrader_config.py file?
Here is /mnt/classdat/nbgrader_config.py
## this nbgrader config is for the nbgrader service account
c = get_config()
c.CourseDirectory.course_id = 'psy360'
c.CourseDirectory.root = '/mnt/classdat/psy360'
##really stupid hack to make it put the DB where i want it.
c.CourseDirectory.db_url = 'sqlite:///../../../mnt/db/gradebook.db'
c.Exchange.root = '/mnt/exchange'
c.FormgradeApp.authenticator_class = "nbgrader.auth.hubauth.HubAuth"
c.HubAuth.hub_base_url = "http://hub:8000"
c.HubAuth.generate_hubapi_token = True
c.NbGrader.logfile = "/mnt/db/nbgrader.log"
I can run other commands successfully from this location:
s_nbgrader@c8fd5164182e:/mnt/classdat$ nbgrader db assignment list
There are 8 assignments in the database:
fred_test (due: None)
- one
ps1_challenge (due: None)
- Chatbot
- Marr
ps2 (due: None)
- 1 - Tversky's Contrast Model
- 2 - Prototype Theory
- 3 - Models of Categorization
- 4 - Psychological Similarity I
- 5 - Psychological Similarity II
test (due: None)
turing_machine_demo (due: None)
- Turing Machine Demo
ps0 (due: 2019-09-08 00:00:00)
- 1 - Introduction to the IPython notebook
- 2 - Markdown and LaTeX Cheatsheet
- 3 - Introduction to NumPy
- 4 - Manipulating and Plotting Data
- 5 - Advanced NumPy
- 6 - Truth Tables
- 7 - Debugging
[... elided ...]
Ah, so if I understand correctly I think the issue is that your nbgrader config is in /mnt/classdat, but then when you run the autograder you are running it from /mnt/classdat/psy360. However, since the nbgrader config is not in /mnt/classdat/psy360, nbgrader does not know about your database and so tells you that it doesn't know about any notebooks. To fix the problem you want to put your nbgrader config in the root of your course directory, i.e. /mnt/classdat/psy360.
Wow, okay. So does that mean that the nbgrader_config.py isn't doing anything? (Someone else set up this up).
I will report back after testing it on a new assignment (after moving the config file).
Another thing that might work is to try running the autograde command from /mnt/classdat instead of /mnt/classdat/psy360.
I really need to add some better documentation about where config files need to live and where the respective commands need to be run from, sorry for the confusion!
Running from /mnt/classdat works! I assume that the config must be working otherwise, so I will leave it where it is. Does that sound right?
Yes, that sounds fine to me. Let's leave this issue open though (I will rename the title) so that I can fix the path it tells you to run commands from (for myself: I think the path should probably been the notebook directory rather than the course root, but I need to check this).