Keep Your Dashboard Clean
Learn how to keep your pipeline runs clean during development.
When developing pipelines, it's common to run and debug them multiple times. To avoid cluttering the server with these development runs, ZenML provides several options:
Run locally
One of the easiest ways to avoid cluttering a shared server / dashboard is to disconnect your client from the remote server and simply spin up a local server:
zenml login --localNote that there are some limitations to this approach, particularly if you want to use remote infrastructure, but if there are local runs that you can do without the need for remote infrastructure, this can be a quick and easy way to keep things clean. When you're ready to reconnect to the server to continue with your shared runs, you can simply run zenml login <remote-url> again.
Pipeline Runs
Deleting Pipeline Runs
If you want to delete a specific pipeline run, you can use a script like this:
zenml pipeline runs delete <PIPELINE_RUN_NAME_OR_ID>If you want to delete all pipeline runs in the last 24 hours, for example, you could run a script like this:
#!/usr/bin/env python3
import datetime
from zenml.client import Client
def delete_recent_pipeline_runs():
# Initialize ZenML client
zc = Client()
# Calculate the timestamp for 24 hours ago
twenty_four_hours_ago = datetime.datetime.now(timezone.utc) - datetime.timedelta(hours=24)
# Format the timestamp as required by ZenML
time_filter = twenty_four_hours_ago.strftime("%Y-%m-%d %H:%M:%S")
# Get the list of pipeline runs created in the last 24 hours
recent_runs = zc.list_pipeline_runs(created=f"gt:{time_filter}")
# Delete each run
for run in recent_runs:
print(f"Deleting run: {run.id} (Created: {run.body.created})")
zc.delete_pipeline_run(run.id)
print(f"Deleted {len(recent_runs)} pipeline runs.")
if __name__ == "__main__":
delete_recent_pipeline_runs()For different time ranges you can update this as appropriate.
Pipelines
Deleting Pipelines
Pipelines that are no longer needed can be deleted using the command:
This allows you to start fresh with a new pipeline, removing all previous runs associated with the deleted pipeline. This is a slightly more drastic approach, but it can sometimes be useful to keep the development environment clean.
Unique Pipeline Names
Pipelines can be given unique names each time they are run to uniquely identify them. This helps differentiate between multiple iterations of the same pipeline during development.
By default ZenML generates names automatically based on the current date and
time, but you can pass in a run_name when defining the pipeline:
Note that pipeline names must be unique. For more information on this feature, see the documentation on naming pipeline runs.
Models
Models are something that you have to explicitly register or pass in as you define your pipeline, so to run a pipeline without it being attached to a model is fairly straightforward: simply don't do the things specified in ourdocumentation on registering models.
In order to delete a model or a specific model version, you can use the CLI or Python SDK to accomplish this. As an example, to delete all versions of a model, you can use:
See the full documentation on how to delete models.
Artifacts
Pruning artifacts
If you want to delete artifacts that are no longer referenced by any pipeline runs, you can use the following CLI command:
By default, this method deletes artifacts physically from the underlying artifact store AND also the entry in the database. You can control this behavior by using the --only-artifact and --only-metadata flags.
For more information, see the documentation for this artifact pruning feature.
Pipeline Snapshots
Pruning unused snapshots
Every pipeline run stores a snapshot of its configuration. Snapshots that you never named and that nothing references anymore, for example because the runs that used them were deleted, only take up space in the database. You can delete those that are older than a given number of days with:
Only snapshots without a name that no pipeline run, deployment, schedule, run template, trigger, or derived snapshot references are considered. Named, recent, and referenced snapshots are always kept. The command reports how many snapshots it found and asks for confirmation before deleting them. Use --dry-run to only see the count, and --yes to skip the confirmation.
When connected to a ZenML server, the deletion runs in the background on the server and the command prints a task ID. Search the server logs for that task ID to follow the progress. Deleting a snapshot can make the snapshot it was derived from unused as well, so the number of deleted snapshots can be higher than the count reported by the dry run.
The pruning commands for artifacts and snapshots are also available under a common zenml prune group, e.g. zenml prune snapshots --older-than-days 90.
Cleaning your environment
As a more drastic measure, the zenml clean command can be used to start from
scratch on your local machine. This will:
delete all pipelines, pipeline runs and associated metadata
delete all artifacts
There is also a --local flag that you can set if you want to delete local files relating to the active stack. Note that zenml clean does not delete artifacts and pipelines on the server; it only deletes the local data and metadata.
By utilizing these options, you can maintain a clean and organized pipeline dashboard, focusing on the runs that matter most for your project.
Last updated
Was this helpful?