Skip to content

redis_stores

Redis Store Implementations for Merlin Data Models

This module provides Redis-backed storage implementations for various Merlin system models. These store classes offer persistence, retrieval, and management capabilities for core system entities like studies, runs, and workers.

Each store implements a consistent interface through inheritance from RedisStoreBase, with specialized functionality added through mixins (like NameMappingMixin for name-based lookups). The stores handle serialization/deserialization, CRUD operations, and maintain appropriate Redis key structures.

See also
  • merlin.backends.redis.redis_base_store: Base classes and mixins
  • merlin.db_scripts.data_models: Data model definitions

RedisLogicalWorkerStore

Bases: RedisStoreBase[LogicalWorkerModel]

A Redis-based store for managing LogicalWorkerModel objects.

Source code in merlin/backends/redis/redis_stores.py
class RedisLogicalWorkerStore(RedisStoreBase[LogicalWorkerModel]):
    """
    A Redis-based store for managing [`LogicalWorkerModel`][db_scripts.data_models.LogicalWorkerModel]
    objects.
    """

    def __init__(self, client: Redis):
        """
        Initialize the `RedisLogicalWorkerStore` with a Redis client.

        Args:
            client: A Redis client instance used to interact with the Redis database.
        """
        super().__init__(client, "logical_worker", LogicalWorkerModel)

__init__(client)

Initialize the RedisLogicalWorkerStore with a Redis client.

Parameters:

Name Type Description Default
client Redis

A Redis client instance used to interact with the Redis database.

required
Source code in merlin/backends/redis/redis_stores.py
def __init__(self, client: Redis):
    """
    Initialize the `RedisLogicalWorkerStore` with a Redis client.

    Args:
        client: A Redis client instance used to interact with the Redis database.
    """
    super().__init__(client, "logical_worker", LogicalWorkerModel)

RedisPhysicalWorkerStore

Bases: NameMappingMixin, RedisStoreBase[PhysicalWorkerModel]

A Redis-based store for managing PhysicalWorkerModel objects.

Source code in merlin/backends/redis/redis_stores.py
class RedisPhysicalWorkerStore(NameMappingMixin, RedisStoreBase[PhysicalWorkerModel]):
    """
    A Redis-based store for managing [`PhysicalWorkerModel`][db_scripts.data_models.PhysicalWorkerModel]
    objects.
    """

    def __init__(self, client: Redis):
        """
        Initialize the `RedisPhysicalWorkerStore` with a Redis client.

        Args:
            client: A Redis client instance used to interact with the Redis database.
        """
        super().__init__(client, "physical_worker", PhysicalWorkerModel)

__init__(client)

Initialize the RedisPhysicalWorkerStore with a Redis client.

Parameters:

Name Type Description Default
client Redis

A Redis client instance used to interact with the Redis database.

required
Source code in merlin/backends/redis/redis_stores.py
def __init__(self, client: Redis):
    """
    Initialize the `RedisPhysicalWorkerStore` with a Redis client.

    Args:
        client: A Redis client instance used to interact with the Redis database.
    """
    super().__init__(client, "physical_worker", PhysicalWorkerModel)

RedisRunStore

Bases: NameMappingMixin, RedisStoreBase[RunModel]

A Redis-based store for managing RunModel objects.

Source code in merlin/backends/redis/redis_stores.py
class RedisRunStore(NameMappingMixin, RedisStoreBase[RunModel]):
    """
    A Redis-based store for managing [`RunModel`][db_scripts.data_models.RunModel]
    objects.
    """

    def __init__(self, client: Redis):
        """
        Initialize the `RedisRunStore` with a Redis client.

        Args:
            client: A Redis client instance used to interact with the Redis database.
        """
        super().__init__(client, "run", RunModel)

__init__(client)

Initialize the RedisRunStore with a Redis client.

Parameters:

Name Type Description Default
client Redis

A Redis client instance used to interact with the Redis database.

required
Source code in merlin/backends/redis/redis_stores.py
def __init__(self, client: Redis):
    """
    Initialize the `RedisRunStore` with a Redis client.

    Args:
        client: A Redis client instance used to interact with the Redis database.
    """
    super().__init__(client, "run", RunModel)

RedisStudyStore

Bases: NameMappingMixin, RedisStoreBase[StudyModel]

A Redis-based store for managing StudyModel objects.

Source code in merlin/backends/redis/redis_stores.py
class RedisStudyStore(NameMappingMixin, RedisStoreBase[StudyModel]):
    """
    A Redis-based store for managing [`StudyModel`][db_scripts.data_models.StudyModel]
    objects.
    """

    def __init__(self, client: Redis):
        """
        Initialize the `RedisStudyStore` with a Redis client.

        Args:
            client: A Redis client instance used to interact with the Redis database.
        """
        super().__init__(client, "study", StudyModel)

__init__(client)

Initialize the RedisStudyStore with a Redis client.

Parameters:

Name Type Description Default
client Redis

A Redis client instance used to interact with the Redis database.

required
Source code in merlin/backends/redis/redis_stores.py
def __init__(self, client: Redis):
    """
    Initialize the `RedisStudyStore` with a Redis client.

    Args:
        client: A Redis client instance used to interact with the Redis database.
    """
    super().__init__(client, "study", StudyModel)