Templates
Create and run pipeline templates in ZenML to standardize execution.
Last updated
Was this helpful?
Create and run pipeline templates in ZenML to standardize execution.
Last updated
Was this helpful?
In ZenML, pipeline templates (also known as "Run Templates") are pre-defined, parameterized configurations for your pipelines that can be easily executed from various interfaces - including the Python SDK, CLI, ZenML dashboard, or REST API. Think of them as blueprints for your pipeline runs, ready to be customized on the fly.
Pipeline Templates are a -only feature. Please to get access.
Imagine your team has built a robust training pipeline that needs to be run regularly with different parameters:
Data Scientists need to experiment with new datasets and hyperparameters
MLOps Engineers need to schedule regular retraining with production data
Stakeholders need to trigger model training through a simple UI without coding
Without templates, each scenario would require:
Direct access to the codebase
Knowledge of pipeline implementation details
Manual pipeline configuration for each run
Pipeline templates solve this problem by creating a reusable configuration that can be executed with different parameters from any interface:
Through Python: Data scientists can programmatically trigger templates with custom parameters
Through REST API: Your CI/CD system can trigger templates via API calls
Through Browser (Pro feature): Non-technical stakeholders can trigger runs directly from the ZenML dashboard by simply filling in a form with the required parameters - no coding required!
This enables your team to standardize execution patterns while maintaining flexibility - perfect for production ML workflows that need to be triggered from various systems.
While the simplest way to execute a ZenML pipeline is to directly call your pipeline function, pipeline templates offer several advantages for more complex workflows:
Standardization: Ensure all pipeline runs follow a consistent configuration pattern
Parameterization: Easily modify inputs and settings without changing code
Remote Execution: Trigger pipelines through the dashboard or API without code access
Team Collaboration: Share ready-to-use pipeline configurations with team members
Automation: Integrate with CI/CD systems or other automated processes
Pipeline templates are particularly useful when working with remote stacks (having at least a remote orchestrator, artifact store, and container registry).
You have several ways to create pipeline templates in ZenML:
You can create a template from an existing pipeline run:
You need to select a pipeline run that was executed on a remote stack (i.e., at least a remote orchestrator, artifact store, and container registry) or have a remote stack active when creating the template.
You can create a template using the ZenML CLI:
You need to have an active remote stack while running this command or you can specify one with the --stack
option.
To create a template through the ZenML dashboard:
Navigate to a pipeline run that was executed on a remote stack
Click on + New Template
Enter a name for the template
Click Create
Once you've created a template, you can run it through various interfaces:
Run a template programmatically:
To run a template from the dashboard:
Either click Run a Pipeline
on the main Pipelines
page, or navigate to a specific template and click Run Template
On the Run Details
page, you can:
Upload a .yaml
configuration file
Modify the configuration using the built-in editor
Click Run
to execute the template
Once you run the template, a new run will be executed on the same stack as the original run.
To run a template through the REST API, you need to make a series of calls:
First, get the pipeline ID:
Using the pipeline ID, get the template ID:
Finally, trigger the pipeline with the template ID:
You can trigger templates from within other pipelines, enabling complex workflows:
This pattern is useful for:
Creating pipeline dependencies
Implementing dynamic workflow orchestration
Building multi-stage ML pipelines where different steps require different resources
Separating data preparation from model training
Read more about:
Use descriptive names for your templates to make them easily identifiable
Document template parameters so other team members understand how to configure them
Start with a working pipeline run before creating a template to ensure it's properly configured
Test templates with different configurations to verify they work as expected
Use version control for your template configurations when storing them as YAML files
Implement access controls to manage who can run specific templates
Monitor template usage to understand how your team is using them
Important: You need to recreate your run templates after upgrading your ZenML server. Templates are tied to specific server versions and may not work correctly after an upgrade.
By using pipeline templates effectively, you can standardize ML workflows, improve team collaboration, and simplify the process of running pipelines in production environments.
Learn how to get a bearer token for the curl commands .