Metadata
zenml.metadata
Initialization of ZenML metadata.
ZenML metadata is any additional, dynamic information that is associated with your pipeline runs and artifacts at runtime.
Modules
lazy_load
Run Metadata Lazy Loader definition.
Classes
LazyRunMetadataResponse
Bases: BaseModel
Lazy run metadata response.
Used if the run metadata is accessed from the model in a pipeline context available only during pipeline compilation.
RunMetadataLazyGetter(_lazy_load_model_name: str, _lazy_load_model_version: Optional[str], _lazy_load_artifact_name: Optional[str] = None, _lazy_load_artifact_version: Optional[str] = None)
Run Metadata Lazy Getter helper class.
It serves the purpose to feed back to the user the metadata lazy loader wrapper for any given key, if called inside a pipeline design time context.
Initialize a RunMetadataLazyGetter.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
_lazy_load_model_name
|
str
|
The model name. |
required |
_lazy_load_model_version
|
Optional[str]
|
The model version. |
required |
_lazy_load_artifact_name
|
Optional[str]
|
The artifact name. |
None
|
_lazy_load_artifact_version
|
Optional[str]
|
The artifact version. |
None
|
Source code in src/zenml/metadata/lazy_load.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
|
metadata_types
Custom types that can be used as metadata of ZenML artifacts.
Classes
DType
Bases: str
Special string class to indicate a data type.
MetadataTypeEnum
Path
Bases: str
Special string class to indicate a path.
StorageSize
Bases: int
Special int class to indicate the storage size in number of bytes.
Uri
Bases: str
Special string class to indicate a URI.
Functions
cast_to_metadata_type(value: object, type_: MetadataTypeEnum) -> MetadataType
Cast an object to a metadata type.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
object
|
The object to cast. |
required |
type_
|
MetadataTypeEnum
|
The metadata type to cast to. |
required |
Returns:
Type | Description |
---|---|
MetadataType
|
The value cast to the given metadata type. |
Source code in src/zenml/metadata/metadata_types.py
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 |
|
get_metadata_type(object_: object) -> MetadataTypeEnum
Get the metadata type enum for a given object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
object_
|
object
|
The object to get the metadata type for. |
required |
Returns:
Type | Description |
---|---|
MetadataTypeEnum
|
The corresponding metadata type enum. |
Raises:
Type | Description |
---|---|
ValueError
|
If the metadata type is not supported. |
Source code in src/zenml/metadata/metadata_types.py
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 |
|
validate_metadata(metadata: Dict[str, MetadataType]) -> Dict[str, MetadataType]
Validate metadata.
This function excludes and warns about metadata values that are too long or of an unsupported type.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
metadata
|
Dict[str, MetadataType]
|
The metadata to validate. |
required |
Returns:
Type | Description |
---|---|
Dict[str, MetadataType]
|
The validated metadata. |
Source code in src/zenml/metadata/metadata_types.py
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 |
|