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."""

Download files

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

Source Distribution

charmed_slurm_oci_runtime_interface-1.0.0.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

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

File details

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

File metadata

  • Download URL: charmed_slurm_oci_runtime_interface-1.0.0.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for charmed_slurm_oci_runtime_interface-1.0.0.tar.gz
Algorithm Hash digest
SHA256 e3dd50513eb80c9bfedbf4556550a5cb8253fca3cb02136b7d435e00ac8d8061
MD5 7d192aff084dc2c10a677cd8b246b07c
BLAKE2b-256 b95653e4cf5684c64d6bc4afbca440d7ad567b1e0dc8ad2306d8c34e009668a2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: charmed_slurm_oci_runtime_interface-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 12.6 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for charmed_slurm_oci_runtime_interface-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4538f0a49a11f34d996f2f88255ed7e77cfe1f4385fa569c1ea19aaa7b2f0cd6
MD5 c5e4c4bc557c36b20fda982d027596ef
BLAKE2b-256 75c326c711b5f8d56826350a2f6a86221365c1faed069241c2ee72e8bbc4fe3b

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 files

0.1.0

2 files

Supported by

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