Skip to main content

CRC JupyterHub Configuration Manager

jh_config_manager is a dynamic configuration manager service for JupyterHub that monitors and updates virtual environment and module configuration information. It writes this information to a cache file for use by custom spawners or UI components.

How It Works

The config manager runs as a background process. It periodically scans a directory containing virtual environments and reads a JSON file describing administrator-managed LMOD modules. When it detects a change in either source, it writes the combined state to a unified cache file, which JupyterHub reads to dynamically populate user-facing spawner options.

The process is designed to run continuously as a JupyterHub service, requiring no manual intervention or restarts to pick up new environments or module configurations.

CLI Options

The background service is configured via the command-line arguments or using environmental variables. Command-line arguments take precedence over environment variables, which in turn take precedence over built-in defaults.

Argument Environment Variable Default Description
-v, --venv_root VENV_ROOT /ihome/crc/install/jupyterhub/hub.5.2.1/envs Path to the root directory containing virtual environments
-m, --modules_config_file MODULES_CONFIG_FILE /ihome/crc/install/jupyterhub/modules_config.json Path to the JSON file describing modules
-c, --cache_file CACHE_FILE /ihome/crc/install/jupyterhub/config_cache.json Path to the output cache file (used by the JupyterHub spawner)
-r, --reload_interval RELOAD_INTERVAL 30 Number of seconds between scans

Installation

This project is available directly from PyPI:

pipx install jh-config-manager

Confirm the CLI command is available in your runtime environment:

jh-config-manager -h

The jh_config_manager utility is intended to run as a managed JupyterHub service rather than a standalone script, so that it starts and stops alongside the Hub and is automatically restarted if it exits unexpectedly. To register it, add an entry to the services list in jupyterhub_config.py, supplying whichever arguments differ from your environment's defaults:

c.JupyterHub.services = [
    {
        'name': 'jh-config-manager',
        'command': [
            'python', '-m', 'jh_config_manager',
            '--venv_root=/ihome/crc/install/jupyterhub/hub.5.2.1/envs',
            '--modules_config_file=/ihome/crc/install/jupyterhub/modules_config.json',
            '--cache_file=/ihome/crc/install/jupyterhub/config_cache.json',
            '--reload_interval=30',
        ],
    },
]

The module configuration file is maintained by administrators and defines the sets of LMOD modules available to users through the spawner UI. Each top-level key identifies a module set and maps to a display name shown to users and a list of modules to load when that set is selected:

{
  "amber24": {
    "display_name": "Amber 2024",
    "modules": [
      "openmpi/4.1.1",
      "amber/24-jupyterhub"
    ]
  },
  "cuda11.2": {
    "display_name": "CUDA 11.2",
    "modules": [
      "cuda/11.2"
    ]
  }
}

The service continuously monitors the virtual environments and module configuration file for changes. Whenever either source changes, it regenerates the cache file in full, combining both into a single document that JupyterHub consults at spawn time. An example output is provided below:

{
  "virtualenvs": [
    "venv1",
    "venv2"
  ],
  "modules": {
    "amber24": {
      "display_name": "Amber 2024",
      "modules": [
        "openmpi/4.1.1",
        "amber/24-jupyterhub"
      ]
    },
    "cuda11.2": {
      "display_name": "CUDA 11.2",
      "modules": [
        "cuda/11.2"
      ]
    }
  }
}

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jh_config_manager-1.0.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jh_config_manager-1.0.0-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file jh_config_manager-1.0.0.tar.gz.

File metadata

  • Download URL: jh_config_manager-1.0.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for jh_config_manager-1.0.0.tar.gz
Algorithm Hash digest
SHA256 4b64ac7d25bdc08469d5f13d1572d63b785835476d21e444332cc476947d538c
MD5 7ddbc14dfdfee5657d35369789f10322
BLAKE2b-256 eadc5a62d394a1ffe67acbc95ae547337a329b551949277f35140f529f763df0

See more details on using hashes here.

File details

Details for the file jh_config_manager-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for jh_config_manager-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e75ec1147140bab44b4b2dfa72fbe65bfc6871b8feba904c79cbd052b5bed47d
MD5 1007469411f243be9ea98f33fec51b51
BLAKE2b-256 a832eb7f3b716e945170e6a0fbf3ce3876a01a5ce135375e0a06c18575547cbf

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page