Skip to content

Base manager

octomate.managers.base

What every manager is built on: the base class and the keyed-lock mixin.

Locks

Locks owned by this manager, shared by operations using the same key.

Source code in octomate/managers/base.py
class Locks[Key: Hashable]:
    """Locks owned by this manager, shared by operations using the same key."""

    @cached_property
    def locks(self) -> dict[Key, asyncio.Lock]:
        return {}

    def lock(self, key: Key) -> asyncio.Lock:
        return self.locks.setdefault(key, asyncio.Lock())

locks cached property

locks: dict[Key, Lock]

lock

lock(key: Key) -> asyncio.Lock
Source code in octomate/managers/base.py
def lock(self, key: Key) -> asyncio.Lock:
    return self.locks.setdefault(key, asyncio.Lock())

Manager

Base for the application's managers.

Source code in octomate/managers/base.py
class Manager:
    """Base for the application's managers."""