asset#
- class predict_backend.utils.asset.Asset(object, label, type, metadata={}, name=None, description=None, version=None)#
Bases:
object
Class for storing objects along with their metadata. Supported object types are AssetTypes. Assets are created by specifying the type of object being stored and a label for the object. The label is intended to describe objects relevant to a specific project, an example would be ‘Jet Engine subsystem N41’. An additional name can specified to differentiate between different versions of a specific object. Assets can be stored and retrieved through the store interface. Assets also allow users to write any notes/important information relevant to an object. They can also be linked to other persistence or asset objects, such as linking a model to the dataset it was trained on.
The type field describes the what kind of object is being stored. Please see the
AssetType
class for the full list of available AssetTypes. In order to store a generic python object, please create an asset with this class with type AssetType.OTHER.- Parameters:
object (
Any
) – The object which is stored by the asset.label (
str
) – Label for the object, can be used later to identify the object.type (
AssetType
) – The type of object being stored.metadata (
Dict
) – Any additional metadata to be stored along with the object.name (
Optional
[str
]) – Identifier to differentiate Assets with the same label.description (
Optional
[str
]) – A description of the asset.version (
Optional
[int
]) – Version of the asset.
- add_engineer_notes(key=None, notes=None)#
- Return type:
None
- add_notes(dict_type, key=None, notes=None)#
Add key value pair to specified notes dictionary. If key is not specified, notes is assumed to be text written by the engineer which is added to a log.
- Return type:
None
- add_user_notes(key=None, notes=None)#
- Return type:
None
- get_object()#
- Return type:
Any
- link_asset(label, asset)#
Function to link asset to other persistence objects. Example use case: linking a model to its training dataset. model_asset = asset(…) model_asset.link_asset(“training dataset”, X_train_asset)
- Return type:
None
- set_description(description)#
- Return type:
None
- set_time_to_live(time_to_live)#
- Return type:
None
- to_bytes(created_in_self_service_flow=False)#
- Return type:
bytes
- class predict_backend.utils.asset.AssetType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)#
Bases:
Enum
- DATASET = 'dataset'#
- EXPLAINER = 'explainer'#
- KNOWLEDGE_GRAPH = 'knowledge-graph'#
- MODEL = 'model'#
- NLPROCESSOR = 'language-processor'#
- OTHER = 'other'#
- SCHEMA = 'schema'#