Use the Client
Interacting with your ZenML instance through the ZenML Client.
Use the Client
Pipelines, runs, stacks, and many other ZenML resources are stored and versioned in a database within your ZenML instance behind the scenes. The ZenML Client
allows you to fetch, update, or even create any of these resources programmatically in Python.
Usage Example
The following example shows how to use the ZenML Client to fetch the last 10 pipeline runs that you ran yourself on the stack that you have currently set:
List of Resources
These are the main ZenML resources that you can interact with via the ZenML Client:
Pipelines, Runs, Artifacts
Pipeline Runs: Information about all pipeline runs that were executed on your ZenML instance.
Step Runs: The steps of all pipeline runs. Mainly useful for directly fetching a specific step of a run by its ID.
Artifacts: Information about all artifacts that were written to your artifact stores as part of pipeline runs.
Stacks, Infrastructure, Authentication
Stack: The stacks registered in your ZenML instance.
Stack Components: The stack components registered in your ZenML instance, e.g., all orchestrators, artifact stores, model deployers, ...
User: The users registered in your ZenML instance. If you are running locally, there will only be a single
default
user.
Client Methods
Reading and Writing Resources
List Methods
Get a list of resources, e.g.:
Except for pipeline runs, all other resources will by default be ordered by creation time ascending. E.g., client.list_artifacts()
would return the first 50 artifacts ever created. You can change the ordering by specifying the sort_by
argument when calling list methods.
Get Methods
Fetch a specific instance of a resource by either resource ID, name, or name prefix, e.g.:
Create, Update, and Delete Methods
Active User and Active Stack
For some use cases you might need to know information about the user that you are authenticated as or the stack that you have currently set as active. You can fetch this information via the client.active_user
and client.active_stack_model
properties respectively, e.g.:
Resource Models
You can think of these models as similar to types in strictly-typed languages, or as the requirements of a single endpoint in an API. In particular, they are not related to machine learning models like decision trees, neural networks, etc.
ZenML also has similar models that define which information is required to create, update, or search resources, named Request Models, Update Models, and Filter Models respectively. However, these models are only used for the server API endpoints, and not for the Client methods.