Operations
Supported entity operations in the SDP configuration DB.
Common
Common DB operations for SDP Configuration Database entities.
- class ska_sdp_config.operations.entity_operations.CollectiveEntityOperations(*_args, **_kwargs)[source]
Bases:
Generic
[ModelT
,ModelKeyT
]Base class defining common operations that can be performed on an entity type that can have multiple of its entities stored in the SDP Config database, all of which are stored under a common prefix. Subclasses need to provide the entities’ prefix and key patterns. The latter are used to verify user invocations and key contents, and build the full key (and thus the SDP config DB path) for a particular entity.
- HAS_OWNER: bool = False
Whether entities of this type have an owner.
- HAS_STATE: bool = False
Whether entities of this type have state.
- KEY_PARTS: dict[str, str]
The
(name, pattern)
string pairs describing how keys are built for elements belonging to this entity. The order in which elements are given affects how full key are generated.
- MODEL_CLASS
The model class for this entity. If given, it must derive from MultiEntityBaseModel, and implement the key_patterns() class method.
alias of
dict
- PREFIX: str
The prefix under which entities are stored in the SDP Configuration DB.
- __call__(*args, **kwargs) EntityOperations[ModelT] [source]
A convenience method that internally forwards all arguments to
index_by_key_parts()
. Available only to entities modelled as plain dictionaries. Entities modelled via pydantic should use the higher level methods offered by this class instead.
- create(value: ModelT) None [source]
Create an entry in the database for this entity. Available only for entities defined as pydantic models.
- create_or_update(value: ModelT) None [source]
Creates or updates an entry in the database with the given entity’s contents. Available only for entities defined as pydantic models.
- delete(index: ModelT | ModelKeyT, recurse: bool = False) None [source]
Deletes this entry from the database. Note that only the key fields from the entity are used to determine the database entry, the rest of the contents don’t need to match those in the database. Available only for entities defined as pydantic model.
- exists(index: ModelT | ModelKeyT) ModelT [source]
Check if the entity exists. See
__call__()
for details on how to specify the entity to be read. Available only for entities defined as pydantic models..
- get(index: ModelT | ModelKeyT) ModelT [source]
Get an entry from the database. See
__call__()
for details on how to specify the entity to be read. Available only for entities defined as pydantic models..
- index_by_key_parts(*key_args, **key_kwargs)[source]
Return operations over a single entity.
Individual entities are accessed by specifying their key. This entity key can be given in the following ways:
Via a
key
keyword argument, in which case it’s taken verbatim and its constituent parts are extracted.Via multiple keyword arguments that make up the full key. The keyword argument names must correspond to the key part names.
If the key has a single part, it can be given as a positional argument for ease of use.
- is_alive(index: ModelT | ModelKeyT) bool [source]
Whether this entity is avlie. Available only for entities defined as pydantic models declaring ownership.
- list_keys(**key_matches_kwargs) list[ModelKeyT] [source]
Like
query_keys()
, but returns a list.
- list_values(**key_matches_kwargs) list[tuple[ModelKeyT, dict]] [source]
Like
query_values()
, but returns a list.
- ownership(index: ModelT | ModelKeyT) OwnershipOperations [source]
Get the operations on entity’s ownership. Available only for entities defined as pydantic models declaring ownership.
- path(index: ModelT | ModelKeyT) str [source]
The full path in the SDP Configuration Database for the given entity.
- query_keys(**key_matches_kwargs) Iterator[ModelKeyT] [source]
Iterate over the keys matching the given constrains.
Constrains are given via keyword arguments, where each keyword argument name corresponds to a key part of this entity type, and the argument value corresponds to the value the key part should have in the database to match the query. If a keyword argument name doesn’t match any key part name an
InvalidKey
error is raised.Keyword argument names can be suffixed with
_prefix
or_suffix
, in which case matching is done not exactly, but by prefix or suffix respectively.Invalid keys in the database are ignored.
- query_values(**key_matches_kwargs) Iterator[tuple[ModelKeyT, ModelT]] [source]
Like
query_keys()
, but yields(key, value)
pairs.
- state(index: ModelT | ModelKeyT) StateOperations [source]
Get the operations on an entity’s state. Available only for entities defined as pydantic models that declare a state.
- class ska_sdp_config.operations.entity_operations.ComparisonMode(value)[source]
Bases:
Enum
Ways to compare two strings (needle and haystack).
- EQ = 3
The needle is equals to the haystack
- PREFIX = 2
The needle appears at the start of the haystack
- SUFFIX = 1
The needle appears at the end of the haystack
- class ska_sdp_config.operations.entity_operations.EntityOperations(txn: BaseTransaction, path: str, key: str | None = None, key_parts: dict | None = None)[source]
Bases:
PathOperations
,Generic
[ModelT
]Base class defining common operations that can be performed on a entity.
- MODEL_CLASS
The model class for this entity.
alias of
dict
- property key: str | None
For entity types with multiple entries, the key to this individual entity. None for entity types with single multiplicity.
- property key_parts: dict
For entity types with multiple entries, the individual parts that make up the entity’s key. Empty for entity types with single multiplicity.
- exception ska_sdp_config.operations.entity_operations.InvalidKey(key: str, pattern: Pattern)[source]
Bases:
RuntimeError
Raised when an invalid key is given, either directly or indirectly.
- class ska_sdp_config.operations.entity_operations.OwnedEntityOperationsMixIn[source]
Bases:
object
Mix-in class to derive from to get access to ownership-related operations.
- property ownership: OwnershipOperations
Get a set of ownership operations for a single entity.
- class ska_sdp_config.operations.entity_operations.OwnershipOperations(txn: BaseTransaction, path: str)[source]
Bases:
PathOperations
Operations performed on an entity’s ownership.
- class ska_sdp_config.operations.entity_operations.PathOperations(txn: BaseTransaction, path: str)[source]
Bases:
object
Operations performed on any path.
- property path: str
The full path in the SDP Configuration Database.
- class ska_sdp_config.operations.entity_operations.StateOperations(txn: BaseTransaction, path: str)[source]
Bases:
PathOperations
Operations performed on an entity’s state.
- class ska_sdp_config.operations.entity_operations.StatefulEntityOperationsMixIn[source]
Bases:
object
Mix-in class to derive from to get access to state-related operations.
- property state: StateOperations
Get a set of state operations for a single entity.
Arbitrary
Arbitrary entity management for the SDP Configuration Database.
- class ska_sdp_config.operations.arbitrary.ArbitraryOperations(txn: BaseTransaction, known_roots: Iterable[str])[source]
Bases:
object
Database operations related to arbitrary entities. Entities are selected at runtime with a given path. If the given path doesn’t belong to the set of known paths given at construction time, a warning is issued.
- __call__(path: str) EntityOperations [source]
Returns a set of operations over the requested arbitrary path.
Component
SDP Component management for the SDP Configuration Database.
Note that the current contents of the SDP Configuration Database
usually contain nothing under /component/<name>
but an ownership record under /component/<name>/owner
.
It is foreseen that this will not be the case anymore in future versions
of the SDP Configuration Database, and therefore we model components
as an entity type with multiple entities.
- class ska_sdp_config.operations.component.ComponentOperations(*_args, **_kwargs)[source]
Bases:
CollectiveEntityOperations
Database operations related to SDP components.
- HAS_OWNER: bool = True
Whether entities of this type have an owner.
- KEY_PARTS: dict[str, str] = {'component_name': '[a-zA-Z0-9_-]+'}
The
(name, pattern)
string pairs describing how keys are built for elements belonging to this entity. The order in which elements are given affects how full key are generated.
- PREFIX: str = '/component'
The prefix under which entities are stored in the SDP Configuration DB.
Deployment
Deployment management for the SDP Configuration Database.
- class ska_sdp_config.operations.deployment.DeploymentOperations(*_args, **_kwargs)[source]
Bases:
CollectiveEntityOperations
Database operations related to deployment management.
- HAS_STATE: bool = True
Whether entities of this type have state.
- MODEL_CLASS
alias of
Deployment
- PREFIX: str = '/deploy'
The prefix under which entities are stored in the SDP Configuration DB.
Execution Block
Execution Block management for SDP Configuration Database.
- class ska_sdp_config.operations.execution_block.ExecutionBlockOperations(*_args, **_kwargs)[source]
Bases:
CollectiveEntityOperations
Database operations related to resource allocation management.
- HAS_STATE: bool = True
Whether entities of this type have state.
- KEY_PARTS: dict[str, str] = {'eb_id': '[a-zA-Z0-9-_]+'}
The
(name, pattern)
string pairs describing how keys are built for elements belonging to this entity. The order in which elements are given affects how full key are generated.
- MODEL_CLASS
alias of
ExecutionBlock
- PREFIX: str = '/eb'
The prefix under which entities are stored in the SDP Configuration DB.
Processing Block
Processing Block management for the SDP Configuration Database.
- class ska_sdp_config.operations.processing_block.ProcessingBlockOperations(*_args, **_kwargs)[source]
Bases:
CollectiveEntityOperations
Database operations related to Processing Block management.
- HAS_OWNER: bool = True
Whether entities of this type have an owner.
- HAS_STATE: bool = True
Whether entities of this type have state.
- MODEL_CLASS
alias of
ProcessingBlock
- PREFIX: str = '/pb'
The prefix under which entities are stored in the SDP Configuration DB.
Script
Script management for SDP Configuration Database.
Flow
Flow management for SDP Configuration Database.
- class ska_sdp_config.operations.flow.FlowOperations(*_args, **_kwargs)[source]
Bases:
CollectiveEntityOperations
[Flow
,Key
]Database operations related to flows management.
- HAS_OWNER: bool = True
Whether entities of this type have an owner.
- HAS_STATE: bool = True
Whether entities of this type have state.
- PREFIX: str = '/flow'
The prefix under which entities are stored in the SDP Configuration DB.
Resource Management
Resource management operations for SDP Configuration Database.
- class ska_sdp_config.operations.resource_management.AllocationOperations(*_args, **_kwargs)[source]
Bases:
CollectiveEntityOperations
[Allocation
,Key
]Database operations related to allocation.
- HAS_OWNER: bool = True
Whether entities of this type have an owner.
- HAS_STATE: bool = True
Whether entities of this type have state.
- MODEL_CLASS
alias of
Allocation
- PREFIX: str = '/allocation'
The prefix under which entities are stored in the SDP Configuration DB.
- class ska_sdp_config.operations.resource_management.RequestOperations(*_args, **_kwargs)[source]
Bases:
CollectiveEntityOperations
[Request
,Key
]Database operations related to requests.
- HAS_OWNER: bool = True
Whether entities of this type have an owner.
- HAS_STATE: bool = True
Whether entities of this type have state.
- PREFIX: str = '/request'
The prefix under which entities are stored in the SDP Configuration DB.
- class ska_sdp_config.operations.resource_management.ResourceOperations(*_args, **_kwargs)[source]
Bases:
CollectiveEntityOperations
[Resource
,Key
]Database operations related to resource.
- HAS_OWNER: bool = True
Whether entities of this type have an owner.
- HAS_STATE: bool = True
Whether entities of this type have state.
- PREFIX: str = '/resource'
The prefix under which entities are stored in the SDP Configuration DB.