【发布时间】:2022-01-13 14:06:29
【问题描述】:
我有一个JupyterHub 服务器托管在 Ubuntu 机器上。
(主要)因为我想避免将数百个潜在用户添加到我选择使用c.JupyterHub.authenticator_class = 'jupyterhub.auth.DummyAuthenticator'(带密码)的机器上
我使用的 Spawner 是
c.JupyterHub.spawner_class = 'jupyterhub.spawner.SimpleLocalProcessSpawner' 虽然我也试过'jupyterhub.spawner.LocalProcessSpawner'。
我希望用户在登录后拥有一些预填充的笔记本。
我第一次尝试https://tljh.jupyter.org/en/latest/howto/content/share-data.html将数据放入/etc/skel,但没有复制。
然后,根据各种文档,我可以设置c.Spawner.pre_spawn_hook = populate_user_home(也尝试过c.SimpleLocalProcessSpawner.pre_spawn_hook = populate_user_home)并让该方法将我想要的文件复制到用户家中。
我的方法看起来像:
def populate_user_home(spawner):
username = spawner.user.name
# DummyAuthenticator creates users in /tmp
volume_path = os.path.join('/tmp', username)
if not os.path.exists(volume_path):
os.mkdir(volume_path, 0o777)
copyDirectory(<path_to_tutorials>, os.path.join(volume_path, 'tutorials'))
问题是这个方法从未被调用过!
- 我做错了什么?
- 是否有另一种(更简单的?)方法来填充新用户的家?
【问题讨论】:
标签: jupyter jupyterhub