Jupyterlab startup delay - failed to connect

We use a simple batch connect app to start jupyterlab inside a conda environment on a shared file system (natively on the worker node, not inside a container).

We notice that sometimes a new session becomes available to the user a few seconds before the jupyterlab server is actually “ready” - if the user clicks “Connect” too quickly they can be greeted by a “Failed to connect” message.
If they click again 2 seconds later, it works fine.

My question: How does OOD determine whether a session is “ready”?
Can I configure an additional delay, or some other condition to be fulfilled before letting a user connect?
What would be best practice here?

P.S. This is still on OOD 2 but happy to upgrade if this mechanism changed in OOD3.

Hi sorry for the trouble.

For an interactive app like this, you could introduce a delay in the after.sh by calling something like sleep 2 or check the port is open using curl before proceeding. The point is it’s the after.sh that you can use to do some checks for this and introduce a delay if needed.

It might be that the button is rendered before the connection file is fully written, but it’s hard to say without more data.

1 Like

Great, thanks a lot. I’ll try that right away.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.