Artifact Stores API π¦
Artifact Stores manage the storage and retrieval of step outputs.
Base Artifact Store
Bases: ABC
Base class for artifact storage backends.
Functions
delete(path: str) -> None
abstractmethod
exists(path: str) -> bool
abstractmethod
list_artifacts(prefix: str = '') -> list[str]
abstractmethod
load(path: str) -> Any
abstractmethod
Load an artifact from storage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Storage path of the artifact |
required |
Returns:
| Type | Description |
|---|---|
Any
|
The loaded artifact |
materialize(obj: Any, name: str, run_id: str, step_name: str, project_name: str = 'default') -> str
Materialize artifact to structured storage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
Any
|
Object to materialize |
required |
name
|
str
|
Name of the artifact |
required |
run_id
|
str
|
ID of the current run |
required |
step_name
|
str
|
Name of the step producing the artifact |
required |
project_name
|
str
|
Name of the project |
'default'
|
Returns:
| Type | Description |
|---|---|
str
|
Path where artifact was saved |
Source code in flowyml/storage/artifacts.py
save(artifact: Any, path: str, metadata: dict | None = None) -> str
abstractmethod
Save an artifact to storage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
artifact
|
Any
|
The artifact to save |
required |
path
|
str
|
Storage path for the artifact |
required |
metadata
|
dict | None
|
Optional metadata dictionary |
None
|
Returns:
| Type | Description |
|---|---|
str
|
Full path where artifact was saved |
Source code in flowyml/storage/artifacts.py
Local Artifact Store
Bases: ArtifactStore
Local filesystem artifact storage.
Initialize local artifact store.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
base_path
|
str
|
Base directory for storing artifacts |
'.flowyml/artifacts'
|
Source code in flowyml/storage/artifacts.py
Functions
delete(path: str) -> None
Delete artifact from filesystem.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Relative path to delete |
required |
Source code in flowyml/storage/artifacts.py
exists(path: str) -> bool
Check if artifact exists.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Relative path to check |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if artifact exists, False otherwise |
Source code in flowyml/storage/artifacts.py
get_metadata(path: str) -> dict | None
Get metadata for an artifact.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Relative path to the artifact |
required |
Returns:
| Type | Description |
|---|---|
dict | None
|
Metadata dictionary or None if no metadata exists |
Source code in flowyml/storage/artifacts.py
list_artifacts(prefix: str = '') -> list[str]
List all artifacts with optional prefix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prefix
|
str
|
Optional prefix filter |
''
|
Returns:
| Type | Description |
|---|---|
list[str]
|
List of artifact paths |
Source code in flowyml/storage/artifacts.py
load(path: str) -> Any
Load artifact from local filesystem.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Relative or absolute path to the artifact |
required |
Returns:
| Type | Description |
|---|---|
Any
|
The loaded artifact |
Source code in flowyml/storage/artifacts.py
materialize(obj: Any, name: str, run_id: str, step_name: str, project_name: str = 'default') -> str
Materialize artifact to structured storage.
Source code in flowyml/storage/artifacts.py
save(artifact: Any, path: str, metadata: dict | None = None) -> str
Save artifact to local filesystem.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
artifact
|
Any
|
The artifact to save |
required |
path
|
str
|
Relative path for the artifact |
required |
metadata
|
dict | None
|
Optional metadata dictionary |
None
|
Returns:
| Type | Description |
|---|---|
str
|
Full path where artifact was saved |
Source code in flowyml/storage/artifacts.py
size(path: str) -> int
Get size of artifact in bytes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Relative path to the artifact |
required |
Returns:
| Type | Description |
|---|---|
int
|
Size in bytes |
Source code in flowyml/storage/artifacts.py
GCS Artifact Store
Bases: ArtifactStore
Google Cloud Storage artifact store.
Stores pipeline artifacts in Google Cloud Storage buckets.
Example
Initialize GCS artifact store.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Name of the artifact store |
'gcs'
|
bucket_name
|
str | None
|
GCS bucket name |
None
|
project_id
|
str | None
|
GCP project ID |
None
|
prefix
|
str
|
Prefix for all artifacts in bucket |
'flowyml'
|
Source code in flowyml/stacks/gcp.py
Functions
exists(path: str) -> bool
Check if artifact exists in GCS.
Source code in flowyml/stacks/gcp.py
load(path: str) -> Any
Load artifact from GCS.
Source code in flowyml/stacks/gcp.py
save(artifact: Any, path: str) -> str
Save artifact to GCS.
Source code in flowyml/stacks/gcp.py
to_dict() -> dict[str, Any]
validate() -> bool
Validate GCS configuration.