Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add warning when course root is not accessible from notebook root #1012

Closed
DavidNemeskey opened this issue Sep 17, 2018 · 6 comments · Fixed by #1125
Closed

Add warning when course root is not accessible from notebook root #1012

DavidNemeskey opened this issue Sep 17, 2018 · 6 comments · Fixed by #1125
Labels
Milestone

Comments

@DavidNemeskey
Copy link

Operating system

Ubuntu 16.04

nbgrader --version

0.5.4

jupyterhub --version (if used with JupyterHub)

0.8.1

jupyter notebook --version

5.6.0

Expected behavior

I set the CourseDirectory.root to /opt/submissions. I expected that this would allow me to have multiple teachers work on the same course (adding students, creating assignments, etc). OK, I know that I should use a proper database for that, but it's a first step.

Actual behavior

With one of the teacher users I could create an assignment. However, when I clicked on it to actually edit it and create the assignment notebook, I got a 404. The URL the system looked at was /user/teacher/submissions/source/<assignment>/.

So it seems that somehow the /opt has become lost from the path, the submissions part was kept and put after the default /user/teacher/, which is the user's home.

If I change the root path to /home/teacher/nbgrader, everything works and the url is /user/teacher/tree/nbgrader/source/<assignment>/.

Note that the db was created in /opt/submissions just fine, I could add users... it's just the formgrader that has this problem.

Steps to reproduce the behavior

Just set CourseDirectory.root to outside the user's home directory.

@DavidNemeskey
Copy link
Author

I know of #859 and #866, but I am on 0.5.4, and #866 was supposedly merged in 0.5.3.

@sigurdurb
Copy link
Contributor

Is there any reason you don't have your course set up as a managed service and then only allow certain users to that service? Let me know if you need any help if you decide to do that 💃

@DavidNemeskey
Copy link
Author

What do you mean by "not set up as a managed service"? (Preferably with links, please.) I am using the https://github.com/jupyterhub/jupyterhub-deploy-teaching repo, so I do have PAM authentication via JupyterHub. That is not the problem.

The problem is that if there are multiple teachers, they cannot cooperate on a single assignment, because each can only work in their own home. If nbgrader root was in a place that all teachers can access (e.g. /opt/submissions), they could. Students would still have their ngrader root inside their home directory.

Of course, I kind of solved the problem by having /home/<user>/nbgrader as the nbgrader root, only for teachers it is not a directory, but a symlink to /opt/submissions. So it's doable, but hacky.

@sigurdurb
Copy link
Contributor

sigurdurb commented Sep 22, 2018

Managed service is basically having a notebook server running under the /services url.
So step one is creating a new user on the system

For example:
adduser --home /home/testcourse20183 --gecos "" --disabled-password testcourse20183
I set up mine based on this config
But I also added some things that are not there:
Here is an example

c.JupyterHub.services = [
{
        'name': 'testcourse20183',
        'url': 'http://127.0.0.1:9426',
        'command': [
            'jupyterhub-singleuser',
            '--group=testcourse_kenn',
            '--debug',
            '--MappingKernelManager.cull_idle_timeout=3600',
            '--MappingKernelManager.cull_interval=300',
        ],
        'user': 'testcourse20183',
        'cwd': '/home/testcourse20183'
    },
]

Then you need the groups

c.JupyterHub.load_groups = {
    'testcourse_kenn': [
        'testuser1',
        'testuser2',
        'testuser3',
    ],
}

Then only the users in testcourse_kenn are allowed to access the course on the path: /services/testcourse20183

@jhamrick
Copy link
Member

jhamrick commented Oct 6, 2018

Hmm, yeah, this has to do with the fact that nbgrader is running as part of the notebook server, which does not allow you to access notebooks outside of the directory where it is running. So it's not a limitation of the home directory itself, but a limitation that you cannot set the course directory to be outside the directory where the notebook server is running.

To support having multiple graders with JupyterHub, the recommended way is indeed as @sigurdurb suggested to use a JupyterHub service, see the documentation here: https://nbgrader.readthedocs.io/en/master/configuration/jupyterhub_config.html#example-use-case-one-class-multiple-graders

@jhamrick
Copy link
Member

jhamrick commented Oct 6, 2018

One thing we could potentially do is try to check if the root is being set outside the root of the notebook directory, and warn the user that this is not possible and point them to the relevant documentation for how to set up the JupyterHub service instead.

@jhamrick jhamrick added this to the 0.6.0 milestone Oct 6, 2018
@jhamrick jhamrick changed the title 404 when nbgrader root is not in the user's home Add warning when course root is not accessible from notebook root May 13, 2019
@jhamrick jhamrick added bug and removed enhancement labels Jun 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants