Skip to content

Commit

Permalink
add extra script for pipeline deletion (#3123)
Browse files Browse the repository at this point in the history
  • Loading branch information
strickvl authored Oct 23, 2024
1 parent 5e7e969 commit af525a9
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions docs/book/how-to/build-pipelines/delete-a-pipeline.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,34 @@ Deleting a pipeline does not automatically delete any of its associated runs or
artifacts.
{% endhint %}

If you want to delete multiple pipelines at once, you might find the Python SDK
preferable. If you have pipelines with the same prefix, you will need to pass in
the `id` of each pipeline separately so ZenML is able to identify them. In this
case, you could use a script like the following:

```python
from zenml.client import Client

client = Client()

# Get the list of pipelines that start with "test_pipeline"
# use a large size to ensure we get all of them
pipelines_list = client.list_pipelines(name="startswith:test_pipeline", size=100)

target_pipeline_ids = [p.id for p in pipelines_list.items]

print(f"Found {len(target_pipeline_ids)} pipelines to delete")

confirmation = input("Do you really want to delete these pipelines? (y/n): ").lower()

if confirmation == 'y':
print(f"Deleting {len(target_pipeline_ids)} pipelines")
for pid in target_pipeline_ids:
client.delete_pipeline(pid)
print("Deletion complete")
else:
print("Deletion cancelled")
```

## Delete a pipeline run

Expand Down

0 comments on commit af525a9

Please sign in to comment.