qhana_plugin_runner.db.models.virtual_plugins module
- class qhana_plugin_runner.db.models.virtual_plugins.DataBlob(plugin_id: str, key: str, value: bytes)
Bases:
object- classmethod delete_value(plugin_id: str, key: str, commit: bool = False)
Delete state for a given key.
- classmethod get_item(plugin_id: str, key: str) DataBlob | None
Get a full item record for a given key.
- classmethod get_value(plugin_id: str, key: str, default: Any = Ellipsis) bytes
Get a value for a given key.
- Parameters:
- Raises:
KeyError – if the key was not found and no default value was provided
- Returns:
the stored state value, or the default value
- Return type:
- class qhana_plugin_runner.db.models.virtual_plugins.PluginState(plugin_id, key, value)
Bases:
objectA table to store persistent plugin state.
The table offers a lightweight key value store for plugins for smallish values. Values are automatically serialized and deserialized. This table is for storing state that is not related to a specific task. Do not use this table to store task state!
- plugin_id
the plugin identifier (with or without version) of the plugin that registered this state.
- Type:
- value
(JSON_LIKE): the stored state.
- classmethod delete_value(plugin_id: str, key: str, commit: bool = False)
Delete state for a given key.
- classmethod get_all_items(plugin_id: str) Sequence[PluginState]
Get all plugin state records for a given plugin.
- Parameters:
plugin_id (str) – the plugin requesting the value (is matched exactly to plugin_id)
- Returns:
the plugin state record
- Return type:
Optional[PluginState]
- classmethod get_all_items_like(plugin_id: str) Sequence[PluginState]
Get all plugin state records for a given plugin.
Like get_all_items, but does not match the entire plugin id. This uses the database like feature so plugin_ids must not contain any % signs!
- Parameters:
plugin_id (str) – the plugin requesting the value. A plugin id without version will match any version
- Returns:
the plugin state record
- Return type:
Optional[PluginState]
- classmethod get_item(plugin_id: str, key: str) PluginState | None
Get a full item record for a given key.
- Parameters:
- Returns:
the plugin state record
- Return type:
Optional[PluginState]
- classmethod get_value(plugin_id: str, key: str, default: Any = Ellipsis) Dict[str, Dict[str, Any] | list | str | float | int | bool | None] | List[Dict[str, Any] | list | str | float | int | bool | None] | str | float | int | bool | None
Get a value for a given key.
- Parameters:
- Raises:
KeyError – if the key was not found and no default value was provided
- Returns:
the stored state value
- Return type:
JSON_LIKE
- classmethod set_value(plugin_id: str, key: str, value: Dict[str, Dict[str, Any] | list | str | float | int | bool | None] | List[Dict[str, Any] | list | str | float | int | bool | None] | str | float | int | bool | None, commit: bool = False) Dict[str, Dict[str, Any] | list | str | float | int | bool | None] | List[Dict[str, Any] | list | str | float | int | bool | None] | str | float | int | bool | None
Set state for a given key.
- Parameters:
- Returns:
the old value if any or None
- Return type:
JSON_LIKE
- class qhana_plugin_runner.db.models.virtual_plugins.VirtualPlugin(parent_id, name, version, description, tags, href)
Bases:
objectA table to keep track of virtual plugins.
- parent_id
the plugin identifier (with or without version) of the plugin that registered this virtual plugin.
- Type:
- classmethod get_all(for_parents: Iterable[str] | None = None, filters: Sequence[ColumnOperators] = ()) List[VirtualPlugin]
- classmethod get_all_by_name(name: str) List[VirtualPlugin]
- property identifier
- property tag_list