Managing scheduled pipelines
A step-by-step tutorial on how to create, update, and delete scheduled pipelines in ZenML
Managing scheduled pipelines
This tutorial demonstrates how to work with scheduled pipelines in ZenML through a practical example. We'll create a simple data processing pipeline that runs on a schedule, update its configuration, and finally clean up by deleting the schedule.
How Scheduling Works in ZenML
ZenML doesn't implement its own scheduler but acts as a wrapper around the scheduling capabilities of supported orchestrators like Vertex AI, Airflow, Kubeflow, and others. When you create a schedule, ZenML:
Translates your schedule definition to the orchestrator's native format
Registers the schedule with the orchestrator's scheduling system
Records the schedule in the ZenML metadata store
The orchestrator then takes over responsibility for executing the pipeline according to the schedule.
For our full reference documentation on schedules, see the Schedule a Pipeline page.
Prerequisites
Before starting this tutorial, make sure you have:
ZenML installed and configured
A supported orchestrator (we'll use Vertex AI in this example)
Basic understanding of ZenML pipelines and steps
Step 1: Create a Simple Pipeline
First, let's create a basic pipeline that we'll schedule. This pipeline will simulate a daily data processing task.
Step 2: Create a Schedule
Now, let's create a schedule for our pipeline. We'll set it to run daily at 9 AM.
Running the pipeline will create the schedule in the ZenML metadata store. as well as the scheduled run in the orchestrator.
Best Practice: Use Descriptive Schedule Names
When creating schedules, follow a consistent naming pattern to better organize them:
Include the frequency, purpose, environment, and version in your schedule names.
Step 3: Verify the Schedule
After creating a schedule, it's important to verify that it exists in both ZenML and the orchestrator. This verification helps ensure your pipeline will run as expected.
Step 3.1: Verify the Schedule in ZenML
Let's check if our schedule was created successfully using both Python and the CLI:
Using the CLI to verify:
Here's an example of what the CLI output might look like:

Step 3.2: Verify the Schedule in the Orchestrator
To ensure the schedule was properly created in Vertex AI, we can verify it using the Google Cloud SDK:
Make sure to replace us-central1 with your actual Vertex AI region. You can find your region in the Vertex AI settings or by checking the location parameter in your Vertex orchestrator configuration.
Step 4: Update the Schedule
Sometimes we need to modify an existing schedule. How you update a schedule depends on your orchestrator:
Kubernetes orchestrator: Supports direct schedule updates - ZenML will update the CronJob directly on the cluster
Most other orchestrators (including Vertex AI used in this tutorial): Do not support direct updates, so you'll need to delete the old schedule and create a new one
For orchestrators that support direct updates, you can simply use:
For orchestrators like Vertex AI that don't support direct updates, follow this two-step process:
Delete the existing schedules (both from ZenML and the orchestrator)
Create a new schedule with the updated configuration
Step 4.1: Delete the Existing Schedule
First, delete the schedule from ZenML (this archives the schedule by default):
Using the CLI:
Important: For orchestrators that don't support native schedule deletion (like Vertex AI), you must also manually delete the schedule from the orchestrator. For orchestrators that do support it (like Kubernetes), ZenML will handle the orchestrator-side deletion automatically.
For Vertex AI, you need to delete the orchestrator schedule:
Step 4.2: Create the Updated Schedule
Now, create a new schedule with the updated parameters:
Or using a script:
Step 5: Monitor Schedule Execution
Let's check the execution history of our scheduled pipeline:
Monitoring with Alerters
For critical pipelines, add alerting to notify you of failures:
This assumes you've registered an alerter (like Slack or Discord) in your active stack.
Step 6: Clean Up
When you're done with a scheduled pipeline, proper cleanup is essential to prevent unexpected executions. The cleanup process depends on your orchestrator:
Kubernetes orchestrator: ZenML handles everything automatically - deleting the schedule in ZenML also deletes the CronJob from the cluster
Most other orchestrators (including Vertex AI): You must perform two separate deletion operations:
Delete the schedule from ZenML's database
Manually delete the schedule from the underlying orchestrator
Since this tutorial uses Vertex AI, we'll demonstrate the two-step manual cleanup process.
Step 6.1: Delete the Schedule from ZenML
First, let's delete the schedule from ZenML. By default, deletion archives the schedule (soft delete), which preserves references in historical pipeline runs:
Using the CLI, you can also perform a hard delete if you want to permanently remove all references:
Step 6.2: Delete the Schedule from the Orchestrator (Required for Vertex AI)
CRITICAL for Vertex AI and similar orchestrators: Deleting a schedule from ZenML does NOT automatically delete it from the orchestrator. If you only perform Step 6.1, your pipeline will continue to run on schedule! (Note: The Kubernetes orchestrator is an exception - it handles orchestrator-side deletion automatically.)
Here's how to delete the schedule from Vertex AI:
The procedure for deleting schedules varies by orchestrator. Always check your orchestrator's documentation for the correct deletion method.
Troubleshooting: Quick Fixes for Common Issues
Here are some practical fixes for issues you might encounter with your scheduled pipelines:
Issue: Timezone Confusion with Scheduled Runs
A common issue with scheduled pipelines is timezone confusion. Here's how ZenML handles timezone information:
If you provide a timezone-aware datetime, ZenML will use it as is
If you provide a datetime without timezone information, ZenML assumes it's in your local timezone and converts it to UTC for storage and communication with orchestrators
For cloud orchestrators like Vertex AI, Kubeflow, and Airflow, schedules typically run in the orchestrator's timezone, which is usually UTC. This can lead to confusion if you expect a schedule to run at 9 AM in your local timezone but it runs at 9 AM UTC instead.
To ensure your schedule runs at the expected time:
Remember that cron expressions themselves don't have timezone information - they're interpreted in the timezone of the system executing them (which for cloud orchestrators is usually UTC).
Issue: Schedule Doesn't Run at the Expected Time
If your pipeline doesn't run when scheduled:
For Vertex AI specifically, verify that your service account has the required permissions:
Issue: Orphaned Schedules in the Orchestrator
To clean up orphaned Vertex AI schedules:
Issue: Finding Failing Scheduled Runs
When scheduled runs fail silently:
Next Steps
Now that you understand the basics of managing scheduled pipelines, you can:
Create more complex schedules with various cron expressions for different business needs
Set up monitoring and alerting to be notified when scheduled runs fail
Optimize resource allocation for your scheduled pipelines
Implement data-dependent scheduling where pipelines trigger based on data availability
For more advanced schedule management and monitoring techniques, check out theZenML documentation.
Last updated
Was this helpful?