Skip to content

Commit

Permalink
Merge pull request #51 from ellisonbg/nbgrader-refactor
Browse files Browse the repository at this point in the history
Nbgrader refactor
  • Loading branch information
ellisonbg committed Jan 4, 2017
2 parents 7bea7b6 + 973405a commit 2cdf615
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 23 deletions.
17 changes: 16 additions & 1 deletion deploy_formgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,21 @@
# This playbook is deployed separately and after `deploy.yml` since the
# instructor's user account must be set up before deploying formgrader

# Multiple formgrade instances can be run on a system, one for each course

- hosts: jupyterhub_hosts
roles:
- formgrade
- {
role: formgrade,
nbgrader_course_id: "course1",
nbgrader_owner: "instructor1",
nbgrader_graders: ["instructor1", "grader1"],
nbgrader_port: 5005
}
- {
role: formgrade,
nbgrader_course_id: "course2",
nbgrader_owner: "instructor2",
nbgrader_graders: ["instructor2", "grader2"],
nbgrader_port: 5006
}
23 changes: 13 additions & 10 deletions docs/source/configure-nbgrader.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,28 @@ The nbgrader package will be installed with the reference deployment.
To run nbgrader's formgrade application or use its notebook
extensions, additional steps are needed.

Configuring the extension
-------------------------
Each user who wants to use the notebook extension will need to run::

$ nbgrader extension activate

Deploy formgrade
----------------
Log into JupyterHub as the main instructor (`nbgrader_owner`).

Run the ansible-playbook to deploy formgrade::
First, edit the :file:`deploy_formgrade.yml` file with the information
for each course you want to start formgrade for. Each course should have a
unique `nbgrader_course_id` and `nbgrader_port`.

Second, make sure that each main instructor (the `nbgrader_owner` for each
course) has logged into JuptyerHub at least once. This ensures that their
home directory has been created. The home directory of the main instructor
is used for the main nbgrader course files. It is assumed that the main
instructor will be running the nbgrader command line programs.

Third, run the ansible-playbook to deploy formgrade::

$ ansible-playbook deploy_formgrade.yml

SSH into the server::
Fourth, SSH into the JupyterHub server::

$ ssh {user}@{hostname}

Restart jupyterhub and nbgrader by doing::
Finally, restart jupyterhub and nbgrader by doing::

$ supervisorctl reload

Expand Down
1 change: 1 addition & 0 deletions group_vars/jupyterhub_hosts
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,4 @@ letsencrypt_ssl_cert_path: "/etc/letsencrypt/live/{{inventory_hostname}}/fullcha

nbgrader_log_dir: /var/log/nbgrader
nbgrader_exchange_dir: /srv/nbgrader/exchange
nbgrader_base_dir: "{{home_dir}}/{{nbgrader_owner}}/nbgrader/{{nbgrader_course_id}}"
10 changes: 0 additions & 10 deletions host_vars/hostname.example
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,6 @@ install_bash_kernel: true
# enter between quotation marks below
proxy_auth_token: ''

# nbgrader and formgrade settings (use_nbgrader default: false)
use_nbgrader: false
nbgrader_course_id: mycourse
nbgrader_owner: instructor
nbgrader_base_dir: "{{home_dir}}/{{nbgrader_owner}}/nbgrader/{{nbgrader_course_id}}"
nbgrader_graders:
- instructor
- grader
nbgrader_port: 5005

# The API token formgrader will use to make Hub requests
# Create using something like `openssl rand -hex 32` and
# enter between quotation marks below
Expand Down
11 changes: 9 additions & 2 deletions roles/nbgrader/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@
- directory
- touch

- name: install the nbgrader extension
command: nbgrader extension install
- name: install the nbgrader nbextensions
command: jupyter nbextension {{item}} --sys-prefix --py nbgrader
become: true
with_items:
- install
- enable

- name: install the nbgrader serverextension
command: jupyter serverextension enable --sys-prefix --py nbgrader
become: true

0 comments on commit 2cdf615

Please sign in to comment.