• Welcome to LiuJason's Blog!

Ubuntu20.04下配置并使用systemctl服务管理Jupyterhub/ipyparallel集群

Linux笔记 Jason 5 months ago (01-10) 85 Views 0 Comments QR code of this page
文章目录[隐藏]

前言

根据 https://jupyterhub.readthedocs.io/en/stable/quickstart.html#installation 安装完成后,如果用screen运行会很麻烦,而且每次重启要手动执行,增加服务之后可以自动守护运行。

在jupyterhub中开启ipyparallel集群功能

安装ipyparallel:pip3 install ipyparallel,GUI界面开启功能:ipcluster nbextension enable,然后全局开启jupyterhub中的功能:

jupyter nbextension install --sys-prefix --py ipyparallel
jupyter nbextension enable --sys-prefix --py ipyparallel
jupyter serverextension enable --sys-prefix --py ipyparallel

方法

Jupyterhub

将以下内容写入/etc/systemd/system/jupyterhub.service,注意配置文件的路径,这里我放在了/root/jupyterhub_config.py

[Unit]
Description=Jupyterhub
After=syslog.target network.target

[Service]
User=root
Environment="PATH=/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"
ExecStart=/usr/local/bin/jupyterhub -f /root/jupyterhub_config.py

[Install]
WantedBy=multi-user.target

ipyparallel集群

将以下内容写入/etc/systemd/system/ipcluster.service

[Unit]
Description=ipcluster
After=syslog.target network.target

[Service]
User=root
Environment="PATH=/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"
ExecStart=/bin/sh -c '/usr/local/bin/ipcluster start'

[Install]
WantedBy=multi-user.target

将以下内容写入/etc/systemd/system/ipengine.service

[Unit]
Description=ipengine
After=syslog.target network.target

[Service]
User=root
Environment="PATH=/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"
ExecStart=/bin/sh -c '/usr/local/bin/ipengine start'

[Install]
WantedBy=multi-user.target

将以下内容写入/etc/systemd/system/ipcontroller.service

[Unit]
Description=ipcontroller
After=syslog.target network.target

[Service]
User=root
Environment="PATH=/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"
ExecStart=/bin/sh -c '/usr/local/bin/ipcontroller --ip=10.1.100.108 start'

[Install]
WantedBy=multi-user.target

This article is under CC BY-NC-SA 4.0 license.
Please quote the original link:https://www.liujason.com/article/1130.html
Like (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址