Monday, August 22, 2016

Autorun JupyterNotebook using Supervisor on Ubuntu 16.04

On this post I will discuss how to make Jupyter Notebook autorun whenever the computer start, I will utilize Supervisor to do that. this post will discuss from how to set and configure the supervisor job

Prerequisite

For installing Supervisor, Jupyterhub and Configure Jupyterhub please refer to the following

Create new Supervisor Job for Jupyter

go to /etc/supervisor/conf.d folder to create a new jupyter.conf file with the following content
[program:jupyter]
command=/usr/bin/python3 /usr/local/bin/jupyterhub --no-ssl
autostart=true
autorestart=true
stderr_logfile=/var/log/jupyterhub.err.log
stdout_logfile=/var/log/jupyterhub.out.log
This script will tell supervisor to run jupyterhub with python3 and with option of not using ssl, and then it will autostart jupyterhub and autorestart if jupyterhub accidentally shuts down, and reassign the Err and Out log to jupyterhub.err.log and jupyterhub.out.log located in /var/log directory

after you create it, then you will need to make supervisor to reread all configuration and update it, then you can check the status
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl status
The result should be as follow
svision@svision:/etc/supervisor/conf.d$ sudo supervisorctl status
jupyter                          RUNNING   pid 7543, uptime 4:37:01

Troubleshooting

  • if the status is STOP, then you can run sudo supervisorctl start jupyter
  • if the status is FATAL, there might be some configuration error, you can check the /var/log/jupyterhub.err.log and/var/log/jupyterhub.out.log for more information

No comments :

Post a Comment