H.T.U Jupyter - refraction-ray/TH2-demos GitHub Wiki
$ module load jupyter
只需设置一次。没有配置文件或密码,无法启动jupyter notebook server。如果之前配置过,请跳过此步。
$ jupyter notebook --generate-config
Writing default config to: /HOME/nscc-user123/.jupyter/jupyter_notebook_config.py
$ python
>>> from notebook.auth import passwd; passwd()
Enter password:
Verify password:
'sha1:fee779b81074:24f0b7f6808fdebdfbacd02937b86355474e7253'
>>> exit()
生成配置文件保存在/HOME/nscc-user123/.jupyter/jupyter_notebook_config.py
。编辑该文件,将上面获得的哈希值赋给c.NotebookApp.password
。如:
c.NotebookApp.password = 'sha1:fee779b81074:24f0b7f6808fdebdfbacd02937b86355474e7253'
$ jupyter_alloc
[2017-05-08 14:23:03] Submitted batch job 509217
[2017-05-08 14:23:08] job not started yet, waiting... (press Ctrl-C to cancel it)
[2017-05-08 14:23:13] job started! Now wait for the jupyter server URL...
Proxy established. Visit jupyter notebook server via: http://172.16.12.34:56789
[2017-05-08 14:23:49] Jupyter URL and logs are also kept in: slurm-509217.out
[2017-05-08 14:23:49] To stop this job, use command 'scancel 509217'
运行后稍等一两分钟,终端会输出服务器网址(上例中为http://172.16.12.34:56789
)。如果屏幕没有输出,请从slurm-xxxx.out文件中查看。jupyter_alloc
命令也可接受sbatch
参数。比如,用-p
参数指定特定计算分区,用-t
参数限制运行时间等。
输入密码:
运行代码:
不使用服务时,请运行scancel <jobid>
终止作业,以免浪费机时。
- 运行
jupyter_alloc
时,如果当前计算资源不足,可能需要排队等候。 -
jupyter_alloc
命令运行并获得网址后,该终端窗口可以关闭,并不影响浏览器的连接。 - 如果无法打开网址,1)检查网络连接是否正常,2)查看slurm-xxxxx.out内的报错信息,3)向技术支持反映情况。
- 有关设置和安全请参考Jupyter文档: