orangeqs.juice.orchestration.jupyterhub#

Jupyterhub Utilities.

Module Contents#

Functions#

ensure_required_directories_exist

Ensure database, user data and configuration directories exist.

ensure_secrets_configured

Ensure secrets for Jupyterhub server Autherntications are configured.

outdated_singleuser_servers

Find the single-user servers that do not use the current single-user image.

warn_about_outdated_servers

Warn if single-user servers use an old image after a hub restart.

render_jupyterhub_hub_configuration

Render Jupyterhub’s Hub configuration file.

render_jupyterhub_container_file

Render Jupyterhub configuration file for the singleuser server.

render_supervisor_files

Render the supervisord configuration for single-user Jupyter servers.

API#

orangeqs.juice.orchestration.jupyterhub.ensure_required_directories_exist(config: orangeqs.juice.orchestration.settings.JupyterHubInstanceSettings) → None#

Ensure database, user data and configuration directories exist.

Parameters#

  • config (JupyterHubInstanceSettings): The settings block for the JupyterHub Instance.

orangeqs.juice.orchestration.jupyterhub.ensure_secrets_configured(config: orangeqs.juice.orchestration.settings.JupyterHubInstanceSettings) → bool#

Ensure secrets for Jupyterhub server Autherntications are configured.

If the JupyterHub Server is configured to use ‘shared-password’ authenticator, creates and writes secrets.

Writes the secrets to a secrets file specified in the JupyterHubInstanceSettings. Replaces the secrets file from env if it already exists

Parameters#

  • config (JupyterHubInstanceSettings): The settings block for the JupyterHub Server.

Returns#

  • bool (False if the file already exists. True if a new file was generated.)

orangeqs.juice.orchestration.jupyterhub.outdated_singleuser_servers(settings: orangeqs.juice.orchestration.settings.OrchestrationSettings) → list[str]#

Find the single-user servers that do not use the current single-user image.

A running container keeps the image that it started with. After the single-user image changes, a container that continued to run uses the old image.

Parameters#

  • settings (OrchestrationSettings): The full Juice orchestration settings.

Returns#

  • (list[str]): The names of the single-user containers that use an old image.

Raises#

  • (RuntimeError): If podman cannot inspect the image or list the containers.

orangeqs.juice.orchestration.jupyterhub.warn_about_outdated_servers(settings: orangeqs.juice.orchestration.settings.OrchestrationSettings) → list[str]#

Warn if single-user servers use an old image after a hub restart.

When the hub stops, it must stop all single-user servers. If podman kills the hub before that is complete, the remaining servers continue to run, and the new hub adopts them. The new hub also adopts servers that ran without a hub. These servers continue to use the old image.

Parameters#

  • settings (OrchestrationSettings): The full Juice orchestration settings.

Returns#

  • (list[str]): The names of the single-user containers that use an old image. If podman fails, this gives a warning and returns an empty list.

orangeqs.juice.orchestration.jupyterhub.render_jupyterhub_hub_configuration(settings: orangeqs.juice.orchestration.settings.OrchestrationSettings) → None#

Render Jupyterhub’s Hub configuration file.

Parameters#

  • settings (JuiceSettings): The full Juice settings containing JupyterHub settings.

orangeqs.juice.orchestration.jupyterhub.render_jupyterhub_container_file(config: orangeqs.juice.orchestration.settings.JupyterHubInstanceSettings) → None#

Render Jupyterhub configuration file for the singleuser server.

Parameters#

  • config (JupyterHubInstanceSettings): The settings block for the JupyterHub Server.

orangeqs.juice.orchestration.jupyterhub.render_supervisor_files(config: orangeqs.juice.orchestration.settings.JupyterHubInstanceSettings) → None#

Render the supervisord configuration for single-user Jupyter servers.