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-0.0.3.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-0.0.3-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: jh_config_manager-0.0.3.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-0.0.3.tar.gz
Algorithm Hash digest
SHA256 87a2eddaa106caa8fa5964e5939da7b75e58c712d780d101b2b2b511ffdd7fa3
MD5 9057960c96090283c9b43db69b7d8e83
BLAKE2b-256 b93e70a03ecb10adda6538adc38a31f86cfc60440474ee8087aee6e49752cd1c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jh_config_manager-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6445daf6ca2bf1dc250f4546d232c682d73e6970be8229df52969c7f966f65fc
MD5 d482065a11e94e912363e98df9c16c3a
BLAKE2b-256 f86cbb17ff1293feb6dc38545d9f839f02ec654137e1283586a64b75197f02a3

See more details on using hashes here.

Release history Release notifications | RSS feed

1.0.0

2 files

This release

0.0.3 This release

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