Skip to main content

An NVIDIA GPU monitoring plugin for the cjm-plugin-system that provides real-time hardware telemetry via nvitop.

Project description

cjm-system-monitor-nvidia

Install

pip install cjm_system_monitor_nvidia

Project Structure

nbs/
├── meta.ipynb   # Metadata introspection for the NVIDIA monitor plugin used by cjm-ctl to generate the registration manifest
└── plugin.ipynb # Plugin implementation for NVIDIA GPU monitoring using nvitop

Total: 2 notebooks

Module Dependencies

graph LR
    meta["meta<br/>meta"]
    plugin["plugin<br/>plugin"]

No cross-module dependencies detected.

CLI Reference

No CLI commands found in this project.

Module Overview

Detailed documentation for each module in the project:

meta (meta.ipynb)

Metadata introspection for the NVIDIA monitor plugin used by cjm-ctl to generate the registration manifest

Import

from cjm_system_monitor_nvidia.meta import (
    get_plugin_metadata
)

Functions

def get_plugin_metadata() -> Dict[str, Any]:  # Plugin metadata for manifest generation
    """Return metadata required to register this plugin with the PluginManager."""
    # Fallback base path (current behavior for backward compatibility)
    base_path = os.path.dirname(os.path.dirname(sys.executable))
    
    # Use CJM config if available, else fallback to env-relative paths
    cjm_data_dir = os.environ.get("CJM_DATA_DIR")
    
    # Plugin data directory
    plugin_name = "cjm-system-monitor-nvidia"
    if cjm_data_dir
    "Return metadata required to register this plugin with the PluginManager."

plugin (plugin.ipynb)

Plugin implementation for NVIDIA GPU monitoring using nvitop

Import

from cjm_system_monitor_nvidia.plugin import (
    NvidiaMonitorPlugin
)

Classes

class NvidiaMonitorPlugin:
    def __init__(self):
        """Initialize the NVIDIA monitor plugin."""
        self.logger = logging.getLogger(f"{__name__}.{type(self).__name__}")
        self.config = {}

    @property
    def name(self) -> str:  # Plugin identifier
    "NVIDIA System Monitor using nvitop."
    
    def __init__(self):
            """Initialize the NVIDIA monitor plugin."""
            self.logger = logging.getLogger(f"{__name__}.{type(self).__name__}")
            self.config = {}
    
        @property
        def name(self) -> str:  # Plugin identifier
        "Initialize the NVIDIA monitor plugin."
    
    def name(self) -> str:  # Plugin identifier
            """Plugin name."""
            return "sys-mon-nvidia"
        
        @property
        def version(self) -> str:  # Plugin version
        "Plugin name."
    
    def version(self) -> str:  # Plugin version
            """Plugin version."""
            return "1.0.0"
    
        def initialize(
            self,
            config: Optional[Dict[str, Any]] = None  # Configuration dictionary
        ) -> None
        "Plugin version."
    
    def initialize(
            self,
            config: Optional[Dict[str, Any]] = None  # Configuration dictionary
        ) -> None
        "Initialize or reconfigure the plugin."
    
    def get_config_schema(self) -> Dict[str, Any]:  # JSON Schema
            """Return JSON Schema for configuration."""
            return {}  # No config needed for monitoring
    
        def get_current_config(self) -> Dict[str, Any]:  # Current config
        "Return JSON Schema for configuration."
    
    def get_current_config(self) -> Dict[str, Any]:  # Current config
            """Return current configuration."""
            return self.config
    
        def cleanup(self) -> None
        "Return current configuration."
    
    def cleanup(self) -> None:
            """Clean up resources."""
            pass
    
        def _get_gpu_info_internal(self) -> Dict[str, Any]:  # Raw GPU data
        "Clean up resources."
    
    def get_system_status(self) -> SystemStats:  # Current system telemetry
        "Collect host CPU/RAM + aggregated GPU stats as a typed SystemStats (CR-3).

Per-process GPU usage is exposed via `list_processes()`. The raw GPU dict
(which includes a `processes` list) is retained in `SystemStats.details`
for the legacy job-monitor consumer until the consumer cascade migrates it
to `list_processes()` (then SG-48 drops `details`)."
    
    def list_processes(self) -> List[ProcessStats]:  # Per-process GPU usage
        "Per-process GPU memory usage as typed ProcessStats (CR-3).

Sources the same nvitop/nvidia-smi enumeration that populates
`get_system_status`'s `details['processes']`; returns `[]` when there is
no GPU or no per-process attribution available."

Project details


Download files

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

Source Distribution

cjm_system_monitor_nvidia-0.0.14.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

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

cjm_system_monitor_nvidia-0.0.14-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

Details for the file cjm_system_monitor_nvidia-0.0.14.tar.gz.

File metadata

File hashes

Hashes for cjm_system_monitor_nvidia-0.0.14.tar.gz
Algorithm Hash digest
SHA256 1bfb2177ca471865897a12f472e4a18d46073c72e584ae7f7869537252e2300b
MD5 59028d9deadc17ab60c8849fae003d5b
BLAKE2b-256 be38429d79b9f1b270e0967ceb16d57a2350b83f29b6c68bc4459523d8fcca75

See more details on using hashes here.

File details

Details for the file cjm_system_monitor_nvidia-0.0.14-py3-none-any.whl.

File metadata

File hashes

Hashes for cjm_system_monitor_nvidia-0.0.14-py3-none-any.whl
Algorithm Hash digest
SHA256 7cc452ad822cb0ddde50a741b90b2fa724e84a52931d1697940c7e311639239a
MD5 f619de3e07a0cb9989f0f062cf8a8a1b
BLAKE2b-256 5c639166fcfd910c82e2b5e799f1a99daa07db21b90bf07d29dbaaca2159c960

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page