Understand stacks

Learning how to switch the infrastructure backend of your code.

This is an older version of the ZenML documentation. To read and view the latest version please visit this up-to-date URL.

Understand stacks

In the previous section, you might have already noticed the term stack in the logs and on the dashboard.


A stack is the combination of tools and infrastructure that your pipelines can run on. When you run ZenML code without configuring a stack, the pipeline will run on the so-called default stack.

Separation of code from configuration and infrastructure

As visualized in the diagram above, there are two separate domains that are connected through ZenML. The left side shows the code domain. The user's Python code is translated into a ZenML pipeline. On the right side, you can see the infrastructure domain, in this case, an instance of the default stack. By separating these two domains, it is easy to switch the environment that the pipeline runs on without making any changes in the code. It also allows domain experts to write code/configure infrastructure without worrying about the other domain.

The default stack

You can explore all your stacks in the dashboard. When you click on a specific one you can see its configuration and all the pipeline runs that were executed using this stack.

Components of a stack

As you can see in the section above, a stack consists of multiple components. All stacks have at minimum an ** orchestrator** and an artifact store.


The orchestrator is responsible for executing the pipeline code. In the simplest case, this will be a simple Python thread on your machine. Let's explore this default orchestrator.

Artifact store

The artifact store is responsible for persisting the step outputs. As we learned in the previous section, the step outputs are not passed along in memory, rather the outputs of each step are stored in the artifact store and then loaded from there when the next step needs them. By default this will also be on your own machine:

There are many more components that you can add to your stacks, like experiment trackers, model deployers, and more. You can see all supported stack component types in a single table view here

Registering a stack

Just to illustrate how to interact with stacks, let's create an alternate local stack. We start by first creating a local artifact store.

Create an artifact store

Create a local stack

With the artifact store created, we can now create a new stack with this artifact store.

To run a pipeline using the new stack:

  1. Set the stack as active on your client

    zenml stack set my_stack
  2. Run your pipeline code (you can use the code from the previous section)

    python main.py

Before we can move on to using a cloud stack, we need to find out more about the ZenML server in the next section.

Last updated