jupyterhub / nbgitpuller

Jupyter server extension to sync a git repository one-way to a local path
https://nbgitpuller.readthedocs.io
BSD 3-Clause "New" or "Revised" License
210 stars 86 forks source link

Wait for Drive to be mounted in Lab #266

Closed stefanoantonel closed 2 years ago

stefanoantonel commented 2 years ago

We are having an issue when the nbgitpuller is trying to clone but the Drive was not mounted in the JupyterLab yet. It fails throwing an No such file or directory error.

This happens the first time when the container is being created, after the drive is mounted, the plugin works fine because the drive is already in place.

Our service kills the containers around every two days or so, therefore this error happens quite often.

I think it could be a good improvement that will make the plugin more robust.

Proposed change

Check that the drive is mounted or wait until this is done. After that git clone the repo.

Alternative options

Who would use this feature?

Everybody

welcome[bot] commented 2 years ago

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively. welcome You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada:

yuvipanda commented 2 years ago

Hi @stefanoantonel! Thanks for opening the issue :) I'm not really sure what you mean by 'drive' here - can you expand on that?

stefanoantonel commented 2 years ago

Hello, I'm talking about the JupyterLab storage / volume

Screenshot 2022-03-25 at 14 56 51

In our setup, this storage volume is a custom one called SeaFile so basically when the instance of JupyterLab is created (per user bases) we 'mount' the custom volume to be accessible to the JupyterLab and that takes a couple of seconds.

I hope it is clear but basically the feature that I'm requesting is before the git clone to check if the destination folder exists and if it does not, wait (with some timeout) before failing.

yuvipanda commented 2 years ago

Ah, thank you for the clarification, @stefanoantonel. If I understand it correctly, this is the filesystem taking some time to really be 'ready' - but the mount call succeeds before the filesystem is actually ready, so there's a delay between the notebook server starting and the filesystem actually being present. I can understand how this can be frustrating!

nbgitpuller just shells out to git for all filesystem operations, and I think git basically assumes POSIX file semantics. nbgitpuller doesn't actually create directories - git does that. Unfortunately, I don't think us maintainers have bandwidth to support custom filesystems with different mounting behaviors. My suggestion is to change this in whatever is spawning your notebook servers (JupyterHub? something else?), and not start the notebook server until the filesystem is fully ready.