Skip to main content

charmed-slurm-oci-runtime-interface

PyPI - Version PyPI - Downloads

Usage

This package provides the integration interface implementation for the slurm_oci_runtime interface. It enables OCI runtime charms - for example, Apptainer - to share their runtime configuration with slurm_oci_runtime requirers like the slurmctld application. The slurm_oci_runtime requirer consumes this data to manage the oci.conf configuration file. When the integration is broken, the requirer is notified so it can remove the OCI runtime configuration.

Installation

Add charmed-slurm-oci-runtime-interface to your Python dependencies. Then in your Python code, import as:

from charmed_slurm_oci_runtime_interface import (
    OCIRuntimeData,
    OCIRuntimeProvider,
    OCIRuntimeRequirer,
)

Direction

flowchart TD
    Provider -- type, executable_path --> Requirer

Behavior

Data is exchanged through the Juju integration application databag. The OCI runtime provider places its configuration - an OCIRuntimeData structure - in its application databag. The slurmctld requirer reads this data to construct the oci.conf configuration file.

Provider

  • Is expected to call set_oci_runtime_data to publish OCIRuntimeData containing the OCI runtime configuration.
  • Is expected to only interact with the integration as the application leader.
  • Is expected to emit SlurmctldConnectedEvent when the relation to slurmctld is created.
  • Is expected to emit SlurmctldReadyEvent when controller data from slurmctld is available.

Requirer

  • Is expected to emit OCIRuntimeReadyEvent when OCI runtime data is available in the application databag.
  • Is expected to emit OCIRuntimeDisconnectedEvent when the OCI runtime application is disconnected.
  • Is expected to call get_oci_runtime_data to retrieve OCIRuntimeData.
  • Is expected to only process events as the application leader.

Example integration data

provider:
  app:
    type: '"apptainer"'
    executable_path: '"/usr/bin/apptainer"'
  unit: {}
requirer:
  app:
    auth_secret_id: "secret:abc123"
    controllers: '["10.0.0.1"]'
    slurmconfig: '{"slurm.conf": {...}}'
  unit: {}

Example usages

Provider charm

"""Example OCI runtime charm providing runtime configuration to slurmctld."""

import ops
from charmed_slurm_oci_runtime_interface import OCIRuntimeData, OCIRuntimeProvider


class ApptainerCharm(ops.CharmBase):
    """An OCI runtime charm that provides configuration to slurmctld."""

    def __init__(self, framework: ops.Framework) -> None:
        super().__init__(framework)
        self.oci_runtime = OCIRuntimeProvider(self, "slurm-oci-runtime")
        self.framework.observe(
            self.oci_runtime.on.slurmctld_ready, self._on_slurmctld_ready
        )

    def _on_slurmctld_ready(self, event: ops.RelationEvent) -> None:
        """Publish OCI runtime data once slurmctld is connected."""
        self.oci_runtime.set_oci_runtime_data(
            OCIRuntimeData(type="apptainer", executable_path="/usr/bin/apptainer")
        )

Requirer charm

"""Example slurmctld charm consuming OCI runtime configuration."""

import ops
from charmed_slurm_oci_runtime_interface import OCIRuntimeData, OCIRuntimeRequirer


class SlurmctldCharm(ops.CharmBase):
    """The slurmctld charm that consumes OCI runtime configuration."""

    def __init__(self, framework: ops.Framework) -> None:
        super().__init__(framework)
        self.oci_runtime = OCIRuntimeRequirer(self, "slurm-oci-runtime")
        self.framework.observe(
            self.oci_runtime.on.oci_runtime_ready, self._on_oci_runtime_ready
        )
        self.framework.observe(
            self.oci_runtime.on.oci_runtime_disconnected,
            self._on_oci_runtime_disconnected,
        )

    def _on_oci_runtime_ready(self, event: ops.RelationEvent) -> None:
        """Handle when OCI runtime data is available."""
        data: OCIRuntimeData = self.oci_runtime.get_oci_runtime_data()
        # Use data.type and data.executable_path to write oci.conf

    def _on_oci_runtime_disconnected(self, event: ops.RelationEvent) -> None:
        """Handle when OCI runtime is disconnected."""

Metadata

Release files for charmed-slurm-oci-runtime-interface 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for charmed-slurm-oci-runtime-interface 1.0.0
File Size Uploaded
charmed_slurm_oci_runtime_interface-1.0.0.tar.gz 9.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for charmed-slurm-oci-runtime-interface 1.0.0
File Interpreter ABI Platform
charmed_slurm_oci_runtime_interface-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 22.4 kB

Release files / charmed_slurm_oci_runtime_interface-1.0.0.tar.gz

Download URL charmed_slurm_oci_runtime_interface-1.0.0.tar.gz
Size 9.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e3dd50513eb80c9bfedbf4556550a5cb8253fca3cb02136b7d435e00ac8d8061
BLAKE2b-256 checksum
How to use checksums
b95653e4cf5684c64d6bc4afbca440d7ad567b1e0dc8ad2306d8c34e009668a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / charmed_slurm_oci_runtime_interface-1.0.0-py3-none-any.whl

Download URL charmed_slurm_oci_runtime_interface-1.0.0-py3-none-any.whl
Size 12.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4538f0a49a11f34d996f2f88255ed7e77cfe1f4385fa569c1ea19aaa7b2f0cd6
BLAKE2b-256 checksum
How to use checksums
75c326c711b5f8d56826350a2f6a86221365c1faed069241c2ee72e8bbc4fe3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.1.0

2 release 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