-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: 'Cleanup All' | ||
description: 'Delete all indexes and collections associated with API key' | ||
|
||
inputs: | ||
PINECONE_API_KEY: | ||
description: 'The Pinecone API key' | ||
required: true | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.9 | ||
- name: Setup Poetry | ||
uses: ./.github/actions/setup-poetry | ||
- name: Cleanup all | ||
shell: bash | ||
run: poetry run python3 scripts/cleanup-all.py | ||
env: | ||
PINECONE_API_KEY: ${{ inputs.PINECONE_API_KEY }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: 'Cleanup All Indexes/Collections' | ||
|
||
on: | ||
workflow_dispatch: {} | ||
|
||
jobs: | ||
cleanup-all: | ||
name: Cleanupu all indexes/collections | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Cleanup all | ||
uses: ./.github/actions/cleanup-all | ||
with: | ||
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import os | ||
from pinecone import Pinecone | ||
|
||
def main(): | ||
pc = Pinecone(api_key=os.environ.get('PINECONE_API_KEY', None)) | ||
|
||
for collection in pc.list_collections().names(): | ||
try: | ||
print('Deleting collection: ' + collection) | ||
pc.delete_collection(collection) | ||
except Exception as e: | ||
print('Failed to delete collection: ' + collection + ' ' + str(e)) | ||
pass | ||
|
||
for index in pc.list_indexes().names(): | ||
try: | ||
print('Deleting index: ' + index) | ||
pc.delete_index(index) | ||
except Exception as e: | ||
print('Failed to delete index: ' + index + ' ' + str(e)) | ||
pass | ||
|
||
if __name__ == '__main__': | ||
main() | ||
|