From f5d1902cadb22d7b99b128d8c288ad46ce516424 Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Sat, 13 Jan 2024 14:44:13 -0500 Subject: [PATCH 01/42] Fix typo --- .github/actions/create-index-legacy/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/create-index-legacy/action.yml b/.github/actions/create-index-legacy/action.yml index 2b99094f9..e9f103524 100644 --- a/.github/actions/create-index-legacy/action.yml +++ b/.github/actions/create-index-legacy/action.yml @@ -46,4 +46,4 @@ runs: PINECONE_ENVIRONMENT: ${{ inputs.PINECONE_ENVIRONMENT }} INDEX_NAME: ${{ inputs.index_name }} DIMENSION: ${{ inputs.dimension }} - METRIC: ${{ inputs.metric } + METRIC: ${{ inputs.metric }} From 0a64e187acfe6d956fc32cf975fb07fdf970b5f3 Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Sat, 13 Jan 2024 14:46:51 -0500 Subject: [PATCH 02/42] Fix typo --- .github/actions/create-index-legacy/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/create-index-legacy/action.yml b/.github/actions/create-index-legacy/action.yml index e9f103524..21f692c08 100644 --- a/.github/actions/create-index-legacy/action.yml +++ b/.github/actions/create-index-legacy/action.yml @@ -40,7 +40,7 @@ runs: - name: Create index id: create-index shell: bash - run: ./python3 scripts/create-index-legacy.py + run: python3 scripts/create-index-legacy.py env: PINECONE_API_KEY: ${{ inputs.PINECONE_API_KEY }} PINECONE_ENVIRONMENT: ${{ inputs.PINECONE_ENVIRONMENT }} From 62bf3e9efa224a6c514d8b6b34174aab2280ad73 Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Sat, 13 Jan 2024 14:52:42 -0500 Subject: [PATCH 03/42] Fix typo --- scripts/create-index-legacy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/create-index-legacy.py b/scripts/create-index-legacy.py index 2a98025e7..f6d9d907e 100644 --- a/scripts/create-index-legacy.py +++ b/scripts/create-index-legacy.py @@ -48,7 +48,7 @@ def main(): print(f'Index description: {description}') print(f'Beginning upsert of 1000 vectors to index {index_name}...') - index = pinecone.Index(name=index_name) + index = pinecone.Index(index_name) for _ in range(100): vector = random_embedding_values(dimension) vecs = [{'id': random_string(10), 'values': vector} for i in range(10)] From 225ec680cd8113790e3da08130963f708c9529e5 Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Sat, 13 Jan 2024 15:01:12 -0500 Subject: [PATCH 04/42] Skip create when already exists --- scripts/create-index-legacy.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/scripts/create-index-legacy.py b/scripts/create-index-legacy.py index f6d9d907e..b3ffaa8c7 100644 --- a/scripts/create-index-legacy.py +++ b/scripts/create-index-legacy.py @@ -30,15 +30,15 @@ def main(): environment=environment ) - if index_name in pinecone.list_indexes(): - print(f'Index {index_name} already exists') - pinecone.delete_index(index_name) - - pinecone.create_index( - name=index_name, - dimension=dimension, - metric=metric - ) + if index_name not in pinecone.list_indexes(): + print(f'Creating index {index_name}...') + pinecone.create_index( + name=index_name, + dimension=dimension, + metric=metric + ) + else: + print(f'Index {index_name} already exists. Skipping create.') print(f'Waiting for index {index_name} to be ready...') time.sleep(60) From c60441a166b80ba1e42a7d16e8075bcfb95442ff Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Sat, 13 Jan 2024 15:04:29 -0500 Subject: [PATCH 05/42] Fix typo --- scripts/create-index-legacy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/create-index-legacy.py b/scripts/create-index-legacy.py index b3ffaa8c7..9fa9e4486 100644 --- a/scripts/create-index-legacy.py +++ b/scripts/create-index-legacy.py @@ -52,7 +52,7 @@ def main(): for _ in range(100): vector = random_embedding_values(dimension) vecs = [{'id': random_string(10), 'values': vector} for i in range(10)] - index.upsert(vectors=[vecs]) + index.upsert(vectors=vecs) print(f'Done upserting.') print(f'Beginning query of index {index_name}...') From 0603163bb70aaab284acb60a30fb5f4b5e7021af Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Sat, 13 Jan 2024 15:05:29 -0500 Subject: [PATCH 06/42] Fix typo --- scripts/create-index-legacy.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/create-index-legacy.py b/scripts/create-index-legacy.py index 9fa9e4486..6be5a1d69 100644 --- a/scripts/create-index-legacy.py +++ b/scripts/create-index-legacy.py @@ -37,13 +37,12 @@ def main(): dimension=dimension, metric=metric ) + print(f'Waiting for index {index_name} to be ready...') + time.sleep(60) + print(f'Done waiting.') else: print(f'Index {index_name} already exists. Skipping create.') - print(f'Waiting for index {index_name} to be ready...') - time.sleep(60) - print(f'Done waiting.') - description = pinecone.describe_index(index_name) print(f'Index description: {description}') From 3cfbbaa3791412de22ff3696fdaa4a79dc559d5b Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Sat, 13 Jan 2024 15:07:18 -0500 Subject: [PATCH 07/42] Fix typo --- scripts/create-index-legacy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/create-index-legacy.py b/scripts/create-index-legacy.py index 6be5a1d69..610b3d677 100644 --- a/scripts/create-index-legacy.py +++ b/scripts/create-index-legacy.py @@ -55,7 +55,7 @@ def main(): print(f'Done upserting.') print(f'Beginning query of index {index_name}...') - index.query(vector=random_embedding_values(dimension)) + index.query(vector=random_embedding_values(dimension), top_k=10) print(f'Done querying.') if __name__ == '__main__': From 69b62231a1cd3ff6ab3a0c4bffd90b6fde89f67d Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Sat, 13 Jan 2024 15:11:05 -0500 Subject: [PATCH 08/42] Make vector count configurable --- .github/actions/create-index-legacy/action.yml | 5 +++++ scripts/create-index-legacy.py | 10 +++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/actions/create-index-legacy/action.yml b/.github/actions/create-index-legacy/action.yml index 21f692c08..e777a7afa 100644 --- a/.github/actions/create-index-legacy/action.yml +++ b/.github/actions/create-index-legacy/action.yml @@ -17,6 +17,10 @@ inputs: description: 'The metric of the index' required: false default: 'cosine' + vectors_to_upsert: + description: 'The number of vectors to upsert' + required: false + default: '1000' PINECONE_ENVIRONMENT: description: 'The environment of the index' required: true @@ -47,3 +51,4 @@ runs: INDEX_NAME: ${{ inputs.index_name }} DIMENSION: ${{ inputs.dimension }} METRIC: ${{ inputs.metric }} + VECTORS_TO_UPSERT: ${{ inputs.vectors_to_upsert }} diff --git a/scripts/create-index-legacy.py b/scripts/create-index-legacy.py index 610b3d677..1deee5a5e 100644 --- a/scripts/create-index-legacy.py +++ b/scripts/create-index-legacy.py @@ -3,6 +3,7 @@ import os import pinecone import time +import math def read_env_var(name): value = os.environ.get(name) @@ -22,6 +23,7 @@ def main(): index_name = read_env_var('INDEX_NAME') dimension = int(read_env_var('DIMENSION')) metric = read_env_var('METRIC') + vectors_to_upsert = int(read_env_var('VECTORS_TO_UPSERT')) print(f'Beginning test with environment {environment} and index {index_name}') @@ -46,11 +48,13 @@ def main(): description = pinecone.describe_index(index_name) print(f'Index description: {description}') - print(f'Beginning upsert of 1000 vectors to index {index_name}...') + print(f'Beginning upsert of {vectors_to_upsert} vectors to index {index_name}...') + batch_size = 10 + num_batches = math.floor(vectors_to_upsert / batch_size) index = pinecone.Index(index_name) - for _ in range(100): + for _ in range(num_batches): vector = random_embedding_values(dimension) - vecs = [{'id': random_string(10), 'values': vector} for i in range(10)] + vecs = [{'id': random_string(10), 'values': vector} for i in range(batch_size)] index.upsert(vectors=vecs) print(f'Done upserting.') From 9426b999ac2d06e4ececd5263f6505b6c9baa6e3 Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Sat, 13 Jan 2024 15:34:15 -0500 Subject: [PATCH 09/42] Add step to inspect index via GCPS --- .../actions/create-index-legacy/action.yml | 2 +- .../create-index-legacy.py | 0 .github/actions/test-legacy-index/action.yml | 45 ++++++++++++++++++ .../actions/test-legacy-index/test-index.py | 47 +++++++++++++++++++ .github/workflows/migration-paths.yaml | 20 ++++++-- 5 files changed, 110 insertions(+), 4 deletions(-) rename {scripts => .github/actions/create-index-legacy}/create-index-legacy.py (100%) create mode 100644 .github/actions/test-legacy-index/action.yml create mode 100644 .github/actions/test-legacy-index/test-index.py diff --git a/.github/actions/create-index-legacy/action.yml b/.github/actions/create-index-legacy/action.yml index e777a7afa..6d5aa946b 100644 --- a/.github/actions/create-index-legacy/action.yml +++ b/.github/actions/create-index-legacy/action.yml @@ -44,7 +44,7 @@ runs: - name: Create index id: create-index shell: bash - run: python3 scripts/create-index-legacy.py + run: python3 .github/actions/create-index-legacy/create-index-legacy.py env: PINECONE_API_KEY: ${{ inputs.PINECONE_API_KEY }} PINECONE_ENVIRONMENT: ${{ inputs.PINECONE_ENVIRONMENT }} diff --git a/scripts/create-index-legacy.py b/.github/actions/create-index-legacy/create-index-legacy.py similarity index 100% rename from scripts/create-index-legacy.py rename to .github/actions/create-index-legacy/create-index-legacy.py diff --git a/.github/actions/test-legacy-index/action.yml b/.github/actions/test-legacy-index/action.yml new file mode 100644 index 000000000..4b0b54e39 --- /dev/null +++ b/.github/actions/test-legacy-index/action.yml @@ -0,0 +1,45 @@ +name: 'Test legacy index on GCPS' +description: 'Uses new client to interact with index created via legacy client' + +inputs: + pinecone_client_version: + description: 'The version of the Pinecone client to use' + required: false + default: '3.0.0.dev8' + index_name: + description: 'The name of the index' + required: true + PINECONE_ENVIRONMENT: + description: 'The environment of the index' + required: true + PINECONE_API_KEY: + description: 'The Pinecone API key' + required: true + vectors_to_upsert: + description: 'The number of vectors to upsert' + required: false + default: '1000' + + +runs: + using: 'composite' + steps: + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: 3.9 + + - name: Install pinecone-client + shell: bash + run: | + pip install pinecone-client==${{ inputs.pinecone_client_version }} + + - name: Create index + id: create-index + shell: bash + run: python3 .github/actions/test-legacy-index/test-index.py + env: + PINECONE_API_KEY: ${{ inputs.PINECONE_API_KEY }} + PINECONE_ENVIRONMENT: ${{ inputs.PINECONE_ENVIRONMENT }} + INDEX_NAME: ${{ inputs.index_name }} + VECTORS_TO_UPSERT: ${{ inputs.vectors_to_upsert }} diff --git a/.github/actions/test-legacy-index/test-index.py b/.github/actions/test-legacy-index/test-index.py new file mode 100644 index 000000000..08fd98917 --- /dev/null +++ b/.github/actions/test-legacy-index/test-index.py @@ -0,0 +1,47 @@ +import random +import string +import os +import time +import math +from pinecone import Pinecone + +def read_env_var(name): + value = os.environ.get(name) + if value is None: + raise Exception('Environment variable {} is not set'.format(name)) + return value + +def random_embedding_values(dimension=2): + return [random.random() for _ in range(dimension)] + +def random_string(length): + return ''.join(random.choice(string.ascii_lowercase) for i in range(length)) + +def main(): + api_key = read_env_var('PINECONE_API_KEY') + environment = read_env_var('PINECONE_ENVIRONMENT') + index_name = read_env_var('INDEX_NAME') + vectors_to_upsert = int(read_env_var('VECTORS_TO_UPSERT')) + + print(f'Beginning test with index {index_name}') + + pc = Pinecone(api_key=api_key) + + print(f'Checking if index {index_name} exists...') + if index_name not in pc.list_indexes().names(): + print(f'Index {index_name} does not exist. Creating...') + raise Exception('Index does not exist. Found indexes: {}'.format(pc.list_indexes().names())) + + print(f'Checking index description...') + description = pc.describe_index(index_name) + print(f'Index description: {description}') + + assert description.name == index_name + assert description.dimension > 0 + assert description.metric != None + assert description.spec.serverless == None + assert description.spec.pod != None + assert description.spec.pod.environment == environment + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/.github/workflows/migration-paths.yaml b/.github/workflows/migration-paths.yaml index 34def16d3..92870e209 100644 --- a/.github/workflows/migration-paths.yaml +++ b/.github/workflows/migration-paths.yaml @@ -6,11 +6,13 @@ on: jobs: create-index-legacy-paid: - name: Create index + name: Migration testing runs-on: ubuntu-latest strategy: max-parallel: 1 matrix: + index_name: + - migration-testing-index env: - asia-southeast1-gcp # - asia-northeast1-gcp @@ -42,6 +44,18 @@ jobs: PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} PINECONE_ENVIRONMENT: ${{ matrix.env }} pinecone_client_version: 2.2.4 - index_name: migration-testing-index + index_name: ${{ matrix.index_name }} dimension: 1536 - metric: cosine \ No newline at end of file + metric: cosine + + - name: Inspect on GCPS + id: inspect-gcps + uses: ./.github/actions/test-legacy-index + with: + PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} + PINECONE_ENVIRONMENT: ${{ matrix.env }} + pinecone_client_version: 3.0.0.dev8 + index_name: ${{ matrix.index_name }} + dimension: 1536 + metric: cosine + \ No newline at end of file From f1af4f1f156c5e11da5c6abe4d43c72ad61defcb Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Sat, 13 Jan 2024 15:43:35 -0500 Subject: [PATCH 10/42] Move scripts, add assertions --- .../actions/create-index-legacy/action.yml | 2 +- .github/actions/test-legacy-index/action.yml | 2 +- .../2.x}/create-index-legacy.py | 0 .../3.x}/test-index.py | 19 +++++++++++++++++-- 4 files changed, 19 insertions(+), 4 deletions(-) rename {.github/actions/create-index-legacy => scripts/2.x}/create-index-legacy.py (100%) rename {.github/actions/test-legacy-index => scripts/3.x}/test-index.py (78%) diff --git a/.github/actions/create-index-legacy/action.yml b/.github/actions/create-index-legacy/action.yml index 6d5aa946b..e3a809246 100644 --- a/.github/actions/create-index-legacy/action.yml +++ b/.github/actions/create-index-legacy/action.yml @@ -44,7 +44,7 @@ runs: - name: Create index id: create-index shell: bash - run: python3 .github/actions/create-index-legacy/create-index-legacy.py + run: python3 scripts/2.x/create-index-legacy.py env: PINECONE_API_KEY: ${{ inputs.PINECONE_API_KEY }} PINECONE_ENVIRONMENT: ${{ inputs.PINECONE_ENVIRONMENT }} diff --git a/.github/actions/test-legacy-index/action.yml b/.github/actions/test-legacy-index/action.yml index 4b0b54e39..cf4a28b5f 100644 --- a/.github/actions/test-legacy-index/action.yml +++ b/.github/actions/test-legacy-index/action.yml @@ -37,7 +37,7 @@ runs: - name: Create index id: create-index shell: bash - run: python3 .github/actions/test-legacy-index/test-index.py + run: python3 scripts/3.x/test-index.py env: PINECONE_API_KEY: ${{ inputs.PINECONE_API_KEY }} PINECONE_ENVIRONMENT: ${{ inputs.PINECONE_ENVIRONMENT }} diff --git a/.github/actions/create-index-legacy/create-index-legacy.py b/scripts/2.x/create-index-legacy.py similarity index 100% rename from .github/actions/create-index-legacy/create-index-legacy.py rename to scripts/2.x/create-index-legacy.py diff --git a/.github/actions/test-legacy-index/test-index.py b/scripts/3.x/test-index.py similarity index 78% rename from .github/actions/test-legacy-index/test-index.py rename to scripts/3.x/test-index.py index 08fd98917..44679d9b9 100644 --- a/.github/actions/test-legacy-index/test-index.py +++ b/scripts/3.x/test-index.py @@ -1,8 +1,6 @@ import random import string import os -import time -import math from pinecone import Pinecone def read_env_var(name): @@ -42,6 +40,23 @@ def main(): assert description.spec.serverless == None assert description.spec.pod != None assert description.spec.pod.environment == environment + assert description.host != None + assert len(description.host) > 0 + assert description.status != None + assert description.status.state == 'Ready' + assert description.status.ready == True + + print(f'Index description looks correct.') + + host_url = description.host + + idx = pc.Index(name=index_name) + + stats = idx.describe_index_stats() + print(f'Index stats: {stats}') + + + if __name__ == '__main__': main() \ No newline at end of file From 31aa95b20593bf1938b86990a0be33906550d32b Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Sat, 13 Jan 2024 15:45:04 -0500 Subject: [PATCH 11/42] Add more envs --- .github/workflows/migration-paths.yaml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/migration-paths.yaml b/.github/workflows/migration-paths.yaml index 92870e209..67b8831a4 100644 --- a/.github/workflows/migration-paths.yaml +++ b/.github/workflows/migration-paths.yaml @@ -15,17 +15,17 @@ jobs: - migration-testing-index env: - asia-southeast1-gcp - # - asia-northeast1-gcp - # - eu-west1-gcp - # - eu-west4-gcp - # - northamerica-northeast1-gcp - # - us-central1-gcp - # - us-east1-gcp - # - us-east4-gcp - # - us-west1-gcp - # - us-west4-gcp - # - eastus-azure - # - us-east-1-aws + - asia-northeast1-gcp + - eu-west1-gcp + - eu-west4-gcp + - northamerica-northeast1-gcp + - us-central1-gcp + - us-east1-gcp + - us-east4-gcp + - us-west1-gcp + - us-west4-gcp + - eastus-azure + - us-east-1-aws # - gcp-starter # - asia-southeast1-gcp-free From b4b9f9fefa25167833b6367a262fb147cbfa6049 Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Sat, 13 Jan 2024 15:57:07 -0500 Subject: [PATCH 12/42] Randomize index names --- .github/actions/create-index-legacy/action.yml | 12 +++++++++--- .github/workflows/migration-paths.yaml | 9 ++------- scripts/2.x/create-index-legacy.py | 13 ++++++++++--- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/.github/actions/create-index-legacy/action.yml b/.github/actions/create-index-legacy/action.yml index e3a809246..7c5f7953f 100644 --- a/.github/actions/create-index-legacy/action.yml +++ b/.github/actions/create-index-legacy/action.yml @@ -6,8 +6,8 @@ inputs: description: 'The version of the Pinecone client to use' required: false default: '2.2.4' - index_name: - description: 'The name of the index' + index_name_prefix: + description: 'The prefix for index names' required: true dimension: description: 'The dimension of the index' @@ -28,6 +28,11 @@ inputs: description: 'The Pinecone API key' required: true +outputs: + index_name: + description: 'The name of the index, including randomized suffix' + value: ${{ steps.create-index.outputs.index_name }} + runs: using: 'composite' steps: @@ -48,7 +53,8 @@ runs: env: PINECONE_API_KEY: ${{ inputs.PINECONE_API_KEY }} PINECONE_ENVIRONMENT: ${{ inputs.PINECONE_ENVIRONMENT }} - INDEX_NAME: ${{ inputs.index_name }} + INDEX_NAME_PREFIX: ${{ inputs.index_name }} DIMENSION: ${{ inputs.dimension }} METRIC: ${{ inputs.metric }} VECTORS_TO_UPSERT: ${{ inputs.vectors_to_upsert }} + diff --git a/.github/workflows/migration-paths.yaml b/.github/workflows/migration-paths.yaml index 67b8831a4..47304d407 100644 --- a/.github/workflows/migration-paths.yaml +++ b/.github/workflows/migration-paths.yaml @@ -9,10 +9,7 @@ jobs: name: Migration testing runs-on: ubuntu-latest strategy: - max-parallel: 1 matrix: - index_name: - - migration-testing-index env: - asia-southeast1-gcp - asia-northeast1-gcp @@ -44,7 +41,7 @@ jobs: PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} PINECONE_ENVIRONMENT: ${{ matrix.env }} pinecone_client_version: 2.2.4 - index_name: ${{ matrix.index_name }} + index_name_prefix: migration-testing-index dimension: 1536 metric: cosine @@ -55,7 +52,5 @@ jobs: PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} PINECONE_ENVIRONMENT: ${{ matrix.env }} pinecone_client_version: 3.0.0.dev8 - index_name: ${{ matrix.index_name }} - dimension: 1536 - metric: cosine + index_name: ${{ steps.create-legacy.outputs.index_name }} \ No newline at end of file diff --git a/scripts/2.x/create-index-legacy.py b/scripts/2.x/create-index-legacy.py index 1deee5a5e..c65231d4e 100644 --- a/scripts/2.x/create-index-legacy.py +++ b/scripts/2.x/create-index-legacy.py @@ -11,20 +11,27 @@ def read_env_var(name): raise Exception('Environment variable {} is not set'.format(name)) return value +def random_string(length): + return ''.join(random.choice(string.ascii_lowercase) for i in range(length)) + def random_embedding_values(dimension=2): return [random.random() for _ in range(dimension)] -def random_string(length): - return ''.join(random.choice(string.ascii_lowercase) for i in range(length)) +def write_gh_output(name, value): + with open(os.environ['GITHUB_OUTPUT'], 'a') as fh: + print(f'{name}={value}', file=fh) def main(): api_key = read_env_var('PINECONE_API_KEY') environment = read_env_var('PINECONE_ENVIRONMENT') - index_name = read_env_var('INDEX_NAME') + index_name_prefix = read_env_var('INDEX_NAME_PREFIX') dimension = int(read_env_var('DIMENSION')) metric = read_env_var('METRIC') vectors_to_upsert = int(read_env_var('VECTORS_TO_UPSERT')) + index_name = index_name_prefix + random_string(10) + write_gh_output('index_name', index_name) + print(f'Beginning test with environment {environment} and index {index_name}') pinecone.init( From 8cf42e0fd726ff55be680275d8b73a83686ef8ca Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Sat, 13 Jan 2024 16:13:35 -0500 Subject: [PATCH 13/42] Add cleanup step --- .github/actions/delete-all-indexes/action.yml | 32 +++++++++++++++++++ .github/workflows/migration-paths.yaml | 14 +++++++- scripts/3.x/delete-all-indexes.py | 24 ++++++++++++++ 3 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 .github/actions/delete-all-indexes/action.yml create mode 100644 scripts/3.x/delete-all-indexes.py diff --git a/.github/actions/delete-all-indexes/action.yml b/.github/actions/delete-all-indexes/action.yml new file mode 100644 index 000000000..08db6ffe9 --- /dev/null +++ b/.github/actions/delete-all-indexes/action.yml @@ -0,0 +1,32 @@ +name: 'Delete all indexes owned by API key' +description: 'Delete all indexes owned by API key' + +inputs: + pinecone_client_version: + description: 'The version of the Pinecone client to use' + required: false + default: '3.0.0.dev8' + 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: Install pinecone-client + shell: bash + run: | + pip install pinecone-client==${{ inputs.pinecone_client_version }} + + - name: Delete all indexes + id: delete-indexes + shell: bash + run: python3 scripts/3.x/delete-all-indexes.py + env: + PINECONE_API_KEY: ${{ inputs.PINECONE_API_KEY }} + diff --git a/.github/workflows/migration-paths.yaml b/.github/workflows/migration-paths.yaml index 47304d407..14424bf2e 100644 --- a/.github/workflows/migration-paths.yaml +++ b/.github/workflows/migration-paths.yaml @@ -53,4 +53,16 @@ jobs: PINECONE_ENVIRONMENT: ${{ matrix.env }} pinecone_client_version: 3.0.0.dev8 index_name: ${{ steps.create-legacy.outputs.index_name }} - \ No newline at end of file + + cleanup: + if: always() + needs: [create-index-legacy-paid] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Delete all indexes + uses: ./.github/actions/delete-all-indexes + with: + PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} + pinecone_client_version: 3.0.0.dev8 \ No newline at end of file diff --git a/scripts/3.x/delete-all-indexes.py b/scripts/3.x/delete-all-indexes.py new file mode 100644 index 000000000..a67ac114b --- /dev/null +++ b/scripts/3.x/delete-all-indexes.py @@ -0,0 +1,24 @@ +import random +import string +import os +from pinecone import Pinecone + +def read_env_var(name): + value = os.environ.get(name) + if value is None: + raise Exception('Environment variable {} is not set'.format(name)) + return value + +def main(): + api_key = read_env_var('PINECONE_API_KEY') + + pc = Pinecone(api_key=api_key) + + indexes = pc.list_indexes() + for index in indexes: + print(f'Deleting index {index.name}...') + pc.delete_index(index.name) + + +if __name__ == '__main__': + main() \ No newline at end of file From f18b272453bbf5384f1bcc2c2209cc81109297f4 Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Sat, 13 Jan 2024 16:17:05 -0500 Subject: [PATCH 14/42] Prefix index names --- .github/actions/create-index-legacy/action.yml | 2 +- .github/workflows/migration-paths.yaml | 2 +- scripts/2.x/create-index-legacy.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/create-index-legacy/action.yml b/.github/actions/create-index-legacy/action.yml index 7c5f7953f..587efc1b9 100644 --- a/.github/actions/create-index-legacy/action.yml +++ b/.github/actions/create-index-legacy/action.yml @@ -53,7 +53,7 @@ runs: env: PINECONE_API_KEY: ${{ inputs.PINECONE_API_KEY }} PINECONE_ENVIRONMENT: ${{ inputs.PINECONE_ENVIRONMENT }} - INDEX_NAME_PREFIX: ${{ inputs.index_name }} + INDEX_NAME_PREFIX: ${{ inputs.index_name_prefix }} DIMENSION: ${{ inputs.dimension }} METRIC: ${{ inputs.metric }} VECTORS_TO_UPSERT: ${{ inputs.vectors_to_upsert }} diff --git a/.github/workflows/migration-paths.yaml b/.github/workflows/migration-paths.yaml index 14424bf2e..dd99ce251 100644 --- a/.github/workflows/migration-paths.yaml +++ b/.github/workflows/migration-paths.yaml @@ -41,7 +41,7 @@ jobs: PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} PINECONE_ENVIRONMENT: ${{ matrix.env }} pinecone_client_version: 2.2.4 - index_name_prefix: migration-testing-index + index_name_prefix: py-migration dimension: 1536 metric: cosine diff --git a/scripts/2.x/create-index-legacy.py b/scripts/2.x/create-index-legacy.py index c65231d4e..25c3eab64 100644 --- a/scripts/2.x/create-index-legacy.py +++ b/scripts/2.x/create-index-legacy.py @@ -29,7 +29,7 @@ def main(): metric = read_env_var('METRIC') vectors_to_upsert = int(read_env_var('VECTORS_TO_UPSERT')) - index_name = index_name_prefix + random_string(10) + index_name = index_name_prefix + '-' + random_string(10) write_gh_output('index_name', index_name) print(f'Beginning test with environment {environment} and index {index_name}') From e37418532f136919f8130f7cdd2716494dc57be2 Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Sat, 13 Jan 2024 16:29:32 -0500 Subject: [PATCH 15/42] Add to PR workflow --- .github/workflows/pr.yaml | 3 +++ .../workflows/{migration-paths.yaml => testing-migration.yaml} | 1 + scripts/3.x/delete-all-indexes.py | 3 +++ 3 files changed, 7 insertions(+) rename .github/workflows/{migration-paths.yaml => testing-migration.yaml} (98%) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 8742622d5..8dfde0755 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -8,6 +8,9 @@ on: workflow_dispatch: {} jobs: + migration-testing: + uses: './.github/workflows/testing-migration.yaml' + secrets: inherit unit-tests: uses: './.github/workflows/testing-unit.yaml' secrets: inherit diff --git a/.github/workflows/migration-paths.yaml b/.github/workflows/testing-migration.yaml similarity index 98% rename from .github/workflows/migration-paths.yaml rename to .github/workflows/testing-migration.yaml index dd99ce251..282bc724f 100644 --- a/.github/workflows/migration-paths.yaml +++ b/.github/workflows/testing-migration.yaml @@ -2,6 +2,7 @@ name: 'Migration testing' on: workflow_dispatch: {} + workflow_call: {} jobs: diff --git a/scripts/3.x/delete-all-indexes.py b/scripts/3.x/delete-all-indexes.py index a67ac114b..94223111a 100644 --- a/scripts/3.x/delete-all-indexes.py +++ b/scripts/3.x/delete-all-indexes.py @@ -15,6 +15,9 @@ def main(): pc = Pinecone(api_key=api_key) indexes = pc.list_indexes() + print(f'Found {len(indexes)} indexes.') + print(f'Indexes: {indexes}') + for index in indexes: print(f'Deleting index {index.name}...') pc.delete_index(index.name) From 9fca04e64c3b7cf88a86570648f49d6b9bac6141 Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Sat, 13 Jan 2024 16:48:42 -0500 Subject: [PATCH 16/42] Rename workflow call --- .github/workflows/pr.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 8dfde0755..34d27ff82 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -8,7 +8,7 @@ on: workflow_dispatch: {} jobs: - migration-testing: + migration-tests: uses: './.github/workflows/testing-migration.yaml' secrets: inherit unit-tests: From 5080edb0474f57ccd8a5d6e71e64018cc28e734d Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Sat, 13 Jan 2024 17:51:18 -0500 Subject: [PATCH 17/42] Bump to the .dev9 release --- .github/actions/delete-all-indexes/action.yml | 2 +- .github/actions/test-legacy-index/action.yml | 2 +- .github/workflows/testing-dependency.yaml | 2 +- .github/workflows/testing-integration.yaml | 2 +- .github/workflows/testing-migration.yaml | 6 +++--- .github/workflows/testing-unit.yaml | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/actions/delete-all-indexes/action.yml b/.github/actions/delete-all-indexes/action.yml index 08db6ffe9..d2bf50e31 100644 --- a/.github/actions/delete-all-indexes/action.yml +++ b/.github/actions/delete-all-indexes/action.yml @@ -5,7 +5,7 @@ inputs: pinecone_client_version: description: 'The version of the Pinecone client to use' required: false - default: '3.0.0.dev8' + default: '3.0.0.dev9' PINECONE_API_KEY: description: 'The Pinecone API key' required: true diff --git a/.github/actions/test-legacy-index/action.yml b/.github/actions/test-legacy-index/action.yml index cf4a28b5f..f02b3a8d0 100644 --- a/.github/actions/test-legacy-index/action.yml +++ b/.github/actions/test-legacy-index/action.yml @@ -5,7 +5,7 @@ inputs: pinecone_client_version: description: 'The version of the Pinecone client to use' required: false - default: '3.0.0.dev8' + default: '3.0.0.dev9' index_name: description: 'The name of the index' required: true diff --git a/.github/workflows/testing-dependency.yaml b/.github/workflows/testing-dependency.yaml index 05ccd7423..ba5a248c9 100644 --- a/.github/workflows/testing-dependency.yaml +++ b/.github/workflows/testing-dependency.yaml @@ -1,4 +1,4 @@ -name: Dependency Testing +name: 'Dependency Tests' on: workflow_call: {} diff --git a/.github/workflows/testing-integration.yaml b/.github/workflows/testing-integration.yaml index e2b0631d3..4119e3bb3 100644 --- a/.github/workflows/testing-integration.yaml +++ b/.github/workflows/testing-integration.yaml @@ -1,4 +1,4 @@ -name: "Integration Tests" +name: 'Integration Tests' 'on': workflow_call: {} diff --git a/.github/workflows/testing-migration.yaml b/.github/workflows/testing-migration.yaml index 282bc724f..dbacf6aaa 100644 --- a/.github/workflows/testing-migration.yaml +++ b/.github/workflows/testing-migration.yaml @@ -1,4 +1,4 @@ -name: 'Migration testing' +name: 'Migration Tests' on: workflow_dispatch: {} @@ -52,7 +52,7 @@ jobs: with: PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} PINECONE_ENVIRONMENT: ${{ matrix.env }} - pinecone_client_version: 3.0.0.dev8 + pinecone_client_version: 3.0.0.dev9 index_name: ${{ steps.create-legacy.outputs.index_name }} cleanup: @@ -66,4 +66,4 @@ jobs: uses: ./.github/actions/delete-all-indexes with: PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} - pinecone_client_version: 3.0.0.dev8 \ No newline at end of file + pinecone_client_version: 3.0.0.dev9 \ No newline at end of file diff --git a/.github/workflows/testing-unit.yaml b/.github/workflows/testing-unit.yaml index f8026409c..7ea420016 100644 --- a/.github/workflows/testing-unit.yaml +++ b/.github/workflows/testing-unit.yaml @@ -1,4 +1,4 @@ -name: "Unit Tests" +name: 'Unit Tests' 'on': workflow_call: {} From b885ebf1557991770878d0eb019f865f810c703b Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Sat, 13 Jan 2024 18:50:21 -0500 Subject: [PATCH 18/42] Create collection on regional control plane --- .../create-collection-legacy/action.yml | 49 ++++++++++++++ .../actions/delete-all-collections/action.yml | 32 +++++++++ .github/workflows/testing-migration.yaml | 44 ++++++++++-- scripts/2.x/create-collection-legacy.py | 67 +++++++++++++++++++ scripts/3.x/delete-all-collections.py | 25 +++++++ scripts/3.x/delete-all-indexes.py | 2 - 6 files changed, 211 insertions(+), 8 deletions(-) create mode 100644 .github/actions/create-collection-legacy/action.yml create mode 100644 .github/actions/delete-all-collections/action.yml create mode 100644 scripts/2.x/create-collection-legacy.py create mode 100644 scripts/3.x/delete-all-collections.py diff --git a/.github/actions/create-collection-legacy/action.yml b/.github/actions/create-collection-legacy/action.yml new file mode 100644 index 000000000..172ad677a --- /dev/null +++ b/.github/actions/create-collection-legacy/action.yml @@ -0,0 +1,49 @@ +name: 'Create Collection (Legacy / Regional Control Plane)' +description: 'Creates a collection to be used in other tests' + +inputs: + pinecone_client_version: + description: 'The version of the Pinecone client to use' + required: false + default: '2.2.4' + collection_name_prefix: + description: 'The prefix for collection names' + required: true + index_name: + description: 'The name of the index to make the collection from' + required: true + PINECONE_ENVIRONMENT: + description: 'The environment of the collection' + required: true + PINECONE_API_KEY: + description: 'The Pinecone API key' + required: true + +outputs: + collection_name: + description: 'The name of the collection, including randomized suffix' + value: ${{ steps.create-collection.outputs.collection_name }} + +runs: + using: 'composite' + steps: + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: 3.9 + + - name: Install pinecone-client + shell: bash + run: | + pip install pinecone-client==${{ inputs.pinecone_client_version }} + + - name: Create collection + id: create-collection + shell: bash + run: python3 scripts/2.x/create-collection-legacy.py + env: + PINECONE_API_KEY: ${{ inputs.PINECONE_API_KEY }} + PINECONE_ENVIRONMENT: ${{ inputs.PINECONE_ENVIRONMENT }} + COLLECTION_NAME_PREFIX: ${{ inputs.collection_name_prefix }} + INDEX_NAME: ${{ inputs.index_name }} + diff --git a/.github/actions/delete-all-collections/action.yml b/.github/actions/delete-all-collections/action.yml new file mode 100644 index 000000000..b03645e8d --- /dev/null +++ b/.github/actions/delete-all-collections/action.yml @@ -0,0 +1,32 @@ +name: 'Delete all collections owned by API key' +description: 'Delete all collections owned by API key' + +inputs: + pinecone_client_version: + description: 'The version of the Pinecone client to use' + required: false + default: '3.0.0.dev9' + 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: Install pinecone-client + shell: bash + run: | + pip install pinecone-client==${{ inputs.pinecone_client_version }} + + - name: Delete all collections + id: delete-collections + shell: bash + run: python3 scripts/3.x/delete-all-collections.py + env: + PINECONE_API_KEY: ${{ inputs.PINECONE_API_KEY }} + diff --git a/.github/workflows/testing-migration.yaml b/.github/workflows/testing-migration.yaml index dbacf6aaa..8f47d5cd2 100644 --- a/.github/workflows/testing-migration.yaml +++ b/.github/workflows/testing-migration.yaml @@ -4,6 +4,12 @@ on: workflow_dispatch: {} workflow_call: {} +env: + NUM_VECTORS: 1000 + DIMENSION: 1536 + METRIC: cosine + LEGACY_CLIENT_VERSION: 2.2.4 + NEW_CLIENT_VERSION: 3.0.0.dev9 jobs: create-index-legacy-paid: @@ -35,26 +41,46 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Create on legacy control plane + - name: Create index and upsert (legacy) id: create-legacy uses: ./.github/actions/create-index-legacy with: PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} PINECONE_ENVIRONMENT: ${{ matrix.env }} - pinecone_client_version: 2.2.4 + pinecone_client_version: ${{ env.LEGACY_CLIENT_VERSION }} index_name_prefix: py-migration - dimension: 1536 - metric: cosine + dimension: ${{ env.DIMENSION }} + metric: ${{ env.METRIC }} + vectors_to_upsert: ${{ ENV.NUM_VECTORS }} - - name: Inspect on GCPS + - name: Test index (GCPS) id: inspect-gcps uses: ./.github/actions/test-legacy-index with: PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} PINECONE_ENVIRONMENT: ${{ matrix.env }} - pinecone_client_version: 3.0.0.dev9 + pinecone_client_version: ${{ env.NEW_CLIENT_VERSION }} + index_name: ${{ steps.create-legacy.outputs.index_name }} + + - name: Create collection (legacy) + id: create-collection-legacy + uses: ./.github/actions/create-collection-legacy + with: + PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} + PINECONE_ENVIRONMENT: ${{ matrix.env }} + pinecone_client_version: ${{ env.LEGACY_CLIENT_VERSION }} + collection_name: py-migration-collection index_name: ${{ steps.create-legacy.outputs.index_name }} + # - name: Inspect collection (new) + # id: inspect-collection-new + # uses: ./.github/actions/test-collection + # with: + # PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} + # PINECONE_ENVIRONMENT: ${{ matrix.env }} + # pinecone_client_version: ${{ env.NEW_CLIENT_VERSION }} + # collection_name: py-migration-collection + cleanup: if: always() needs: [create-index-legacy-paid] @@ -64,6 +90,12 @@ jobs: uses: actions/checkout@v4 - name: Delete all indexes uses: ./.github/actions/delete-all-indexes + with: + PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} + pinecone_client_version: 3.0.0.dev9 + + - name: Delete all collections + uses: ./.github/actions/delete-all-collections with: PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} pinecone_client_version: 3.0.0.dev9 \ No newline at end of file diff --git a/scripts/2.x/create-collection-legacy.py b/scripts/2.x/create-collection-legacy.py new file mode 100644 index 000000000..387b50b27 --- /dev/null +++ b/scripts/2.x/create-collection-legacy.py @@ -0,0 +1,67 @@ +import random +import string +import os +import pinecone +import time +import math + +def read_env_var(name): + value = os.environ.get(name) + if value is None: + raise Exception('Environment variable {} is not set'.format(name)) + return value + +def random_string(length): + return ''.join(random.choice(string.ascii_lowercase) for i in range(length)) + +def write_gh_output(name, value): + with open(os.environ['GITHUB_OUTPUT'], 'a') as fh: + print(f'{name}={value}', file=fh) + +def main(): + api_key = read_env_var('PINECONE_API_KEY') + environment = read_env_var('PINECONE_ENVIRONMENT') + collection_name_prefix = read_env_var('COLLECTION_NAME_PREFIX') + index_name = read_env_var('INDEX_NAME') + + print(f'Beginning test with environment {environment} and index {index_name}') + + pinecone.init( + api_key=api_key, + environment=environment + ) + + if index_name not in pinecone.list_indexes(): + raise Exception(f'Index {index_name} does not exist. Cannot create collection.') + + collection_name = collection_name_prefix + '-' + random_string(10) + write_gh_output('collection_name', collection_name) + print(f'Creating collection {collection_name}...') + + pinecone.create_collection( + name=collection_name, + index_name=index_name + ) + + print(f'Waiting for collection {collection_name} to be ready...') + collection_ready = False + max_wait = 120 + while not collection_ready and max_wait >= 0: + try: + collection_description = pinecone.describe_collection(collection_name) + print(f'Collection description: {collection_description}') + if collection_description['status'] == 'Ready': + collection_ready = True + else: + print(f'Collection {collection_name} not ready yet. Waiting...') + max_wait -= 10 + time.sleep(10) + except Exception as e: + print(f'Error while polling for collection {collection_name} status: {e}') + time.sleep(10) + + if not collection_ready: + raise Exception(f'Collection {collection_name} not ready after waiting for {max_wait} seconds.') + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/scripts/3.x/delete-all-collections.py b/scripts/3.x/delete-all-collections.py new file mode 100644 index 000000000..f7322b6c1 --- /dev/null +++ b/scripts/3.x/delete-all-collections.py @@ -0,0 +1,25 @@ +import os +from pinecone import Pinecone + +def read_env_var(name): + value = os.environ.get(name) + if value is None: + raise Exception('Environment variable {} is not set'.format(name)) + return value + +def main(): + api_key = read_env_var('PINECONE_API_KEY') + + pc = Pinecone(api_key=api_key) + + collections = pc.list_collections() + print(f'Found {len(indexes)} collections.') + print(f'Collections: {collections}') + + for collection in collections: + print(f'Deleting collection {collection.name}...') + pc.delete_collection(collection.name) + + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/scripts/3.x/delete-all-indexes.py b/scripts/3.x/delete-all-indexes.py index 94223111a..f1abd604a 100644 --- a/scripts/3.x/delete-all-indexes.py +++ b/scripts/3.x/delete-all-indexes.py @@ -1,5 +1,3 @@ -import random -import string import os from pinecone import Pinecone From 2fbe0b13429dcea229debbe3b706c662555ff7c0 Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Sat, 13 Jan 2024 19:00:19 -0500 Subject: [PATCH 19/42] Fix errors in collections steps --- scripts/2.x/create-collection-legacy.py | 2 +- scripts/3.x/delete-all-collections.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/2.x/create-collection-legacy.py b/scripts/2.x/create-collection-legacy.py index 387b50b27..9e0a0cde6 100644 --- a/scripts/2.x/create-collection-legacy.py +++ b/scripts/2.x/create-collection-legacy.py @@ -40,7 +40,7 @@ def main(): pinecone.create_collection( name=collection_name, - index_name=index_name + source=index_name ) print(f'Waiting for collection {collection_name} to be ready...') diff --git a/scripts/3.x/delete-all-collections.py b/scripts/3.x/delete-all-collections.py index f7322b6c1..065323742 100644 --- a/scripts/3.x/delete-all-collections.py +++ b/scripts/3.x/delete-all-collections.py @@ -13,7 +13,7 @@ def main(): pc = Pinecone(api_key=api_key) collections = pc.list_collections() - print(f'Found {len(indexes)} collections.') + print(f'Found {len(collections)} collections.') print(f'Collections: {collections}') for collection in collections: From d65b5cf9c1089432f51aac0b4b5205c6763a3a05 Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Sat, 13 Jan 2024 19:16:35 -0500 Subject: [PATCH 20/42] WIP on testing collections --- .github/actions/test-collection/action.yml | 40 +++++++++++++++ .github/workflows/testing-migration.yaml | 29 +++++++---- scripts/3.x/test-collection.py | 58 ++++++++++++++++++++++ 3 files changed, 116 insertions(+), 11 deletions(-) create mode 100644 .github/actions/test-collection/action.yml create mode 100644 scripts/3.x/test-collection.py diff --git a/.github/actions/test-collection/action.yml b/.github/actions/test-collection/action.yml new file mode 100644 index 000000000..79ab92fd0 --- /dev/null +++ b/.github/actions/test-collection/action.yml @@ -0,0 +1,40 @@ +name: 'Test legacy collection on GCPS' +description: 'Uses new client to interact with collection created via legacy client' + +inputs: + pinecone_client_version: + description: 'The version of the Pinecone client to use' + required: false + default: '3.0.0.dev9' + collection_name: + description: 'The name of the collection' + required: true + PINECONE_ENVIRONMENT: + description: 'The environment of the index' + required: true + 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: Install pinecone-client + shell: bash + run: | + pip install pinecone-client==${{ inputs.pinecone_client_version }} + + - name: Test collection + id: test-collection + shell: bash + run: python3 scripts/3.x/test-collection.py + env: + PINECONE_API_KEY: ${{ inputs.PINECONE_API_KEY }} + PINECONE_ENVIRONMENT: ${{ inputs.PINECONE_ENVIRONMENT }} + COLLECTION_NAME: ${{ inputs.collection_name }} + VECTORS_TO_UPSERT: ${{ inputs.vectors_to_upsert }} diff --git a/.github/workflows/testing-migration.yaml b/.github/workflows/testing-migration.yaml index 8f47d5cd2..1485ba0e4 100644 --- a/.github/workflows/testing-migration.yaml +++ b/.github/workflows/testing-migration.yaml @@ -72,16 +72,16 @@ jobs: collection_name: py-migration-collection index_name: ${{ steps.create-legacy.outputs.index_name }} - # - name: Inspect collection (new) - # id: inspect-collection-new - # uses: ./.github/actions/test-collection - # with: - # PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} - # PINECONE_ENVIRONMENT: ${{ matrix.env }} - # pinecone_client_version: ${{ env.NEW_CLIENT_VERSION }} - # collection_name: py-migration-collection + - name: Inspect collection (new) + id: inspect-collection-new + uses: ./.github/actions/test-collection + with: + PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} + PINECONE_ENVIRONMENT: ${{ matrix.env }} + pinecone_client_version: ${{ env.NEW_CLIENT_VERSION }} + collection_name: ${{ steps.create-collection-legacy.outputs.collection_name }} - cleanup: + cleanup-indexes: if: always() needs: [create-index-legacy-paid] runs-on: ubuntu-latest @@ -92,10 +92,17 @@ jobs: uses: ./.github/actions/delete-all-indexes with: PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} - pinecone_client_version: 3.0.0.dev9 + pinecone_client_version: ${{ env.NEW_CLIENT_VERSION }} + cleanup-collections: + if: always() + needs: [create-index-legacy-paid] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 - name: Delete all collections uses: ./.github/actions/delete-all-collections with: PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} - pinecone_client_version: 3.0.0.dev9 \ No newline at end of file + pinecone_client_version: ${{ env.NEW_CLIENT_VERSION }} \ No newline at end of file diff --git a/scripts/3.x/test-collection.py b/scripts/3.x/test-collection.py new file mode 100644 index 000000000..bc121132d --- /dev/null +++ b/scripts/3.x/test-collection.py @@ -0,0 +1,58 @@ +import random +import string +import os +from pinecone import Pinecone + +def read_env_var(name): + value = os.environ.get(name) + if value is None: + raise Exception('Environment variable {} is not set'.format(name)) + return value + +def random_string(length): + return ''.join(random.choice(string.ascii_lowercase) for i in range(length)) + +def main(): + api_key = read_env_var('PINECONE_API_KEY') + environment = read_env_var('PINECONE_ENVIRONMENT') + collection_name = read_env_var('COLLECTION_NAME') + + print(f'Beginning test with environment {environment} and collection {collection_name}') + + pc = Pinecone(api_key=api_key) + + print(f'Checking if collection {collection_name} exists...') + if collection_name not in pc.list_collections().names(): + print(f'Index {index_name} does not exist. Creating...') + raise Exception('Index does not exist. Found indexes: {}'.format(pc.list_indexes().names())) + + print(f'Checking index description...') + description = pc.describe_index(index_name) + print(f'Index description: {description}') + + assert description.name == index_name + assert description.dimension > 0 + assert description.metric != None + assert description.spec.serverless == None + assert description.spec.pod != None + assert description.spec.pod.environment == environment + assert description.host != None + assert len(description.host) > 0 + assert description.status != None + assert description.status.state == 'Ready' + assert description.status.ready == True + + print(f'Index description looks correct.') + + host_url = description.host + + idx = pc.Index(name=index_name) + + stats = idx.describe_index_stats() + print(f'Index stats: {stats}') + + + + +if __name__ == '__main__': + main() \ No newline at end of file From e4c37b7ae74c74ff478c8d6df1e6106af641914e Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Sat, 13 Jan 2024 19:29:32 -0500 Subject: [PATCH 21/42] WIP on testing collections --- scripts/3.x/test-collection.py | 32 +++----------------------------- 1 file changed, 3 insertions(+), 29 deletions(-) diff --git a/scripts/3.x/test-collection.py b/scripts/3.x/test-collection.py index bc121132d..204a7493c 100644 --- a/scripts/3.x/test-collection.py +++ b/scripts/3.x/test-collection.py @@ -21,36 +21,10 @@ def main(): pc = Pinecone(api_key=api_key) - print(f'Checking if collection {collection_name} exists...') - if collection_name not in pc.list_collections().names(): - print(f'Index {index_name} does not exist. Creating...') - raise Exception('Index does not exist. Found indexes: {}'.format(pc.list_indexes().names())) - - print(f'Checking index description...') - description = pc.describe_index(index_name) - print(f'Index description: {description}') + print(f'Checking collection description...') + description = pc.describe_collection(collection_name) + print(f'Collection description: {description}') - assert description.name == index_name - assert description.dimension > 0 - assert description.metric != None - assert description.spec.serverless == None - assert description.spec.pod != None - assert description.spec.pod.environment == environment - assert description.host != None - assert len(description.host) > 0 - assert description.status != None - assert description.status.state == 'Ready' - assert description.status.ready == True - - print(f'Index description looks correct.') - - host_url = description.host - - idx = pc.Index(name=index_name) - - stats = idx.describe_index_stats() - print(f'Index stats: {stats}') - From c86b19b694a871a64e0a47853f3f5ce955b105d8 Mon Sep 17 00:00:00 2001 From: Jennifer Hamon Date: Sat, 13 Jan 2024 14:27:23 -0500 Subject: [PATCH 22/42] Temporarily revert docs changes (#275) ## Problem Not ready to go live with new docs until we publish the release ## Solution Revert readme changes, disable SDK reference doc generation on main. ## Type of Change - [x] Bug fix (non-breaking change which fixes an issue) --- .github/workflows/merge.yaml | 24 +++---- README.md | 129 +++++++++++++++-------------------- 2 files changed, 67 insertions(+), 86 deletions(-) diff --git a/.github/workflows/merge.yaml b/.github/workflows/merge.yaml index 394ed3154..4e7953043 100644 --- a/.github/workflows/merge.yaml +++ b/.github/workflows/merge.yaml @@ -18,15 +18,15 @@ jobs: with: python-version: 3.11 - - name: Push documentation artifacts to sdk-docs - uses: cpina/github-action-push-to-another-repository@main - env: - SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }} - with: - source-directory: docs - destination-github-username: pinecone-io - destination-repository-name: sdk-docs - user-email: clients@pinecone.io - target-branch: main - target-directory: python - commit-message: 'Python: automated documentation build - pinecone-python-client merge SHA: ${{ github.sha }}' + # - name: Push documentation artifacts to sdk-docs + # uses: cpina/github-action-push-to-another-repository@main + # env: + # SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }} + # with: + # source-directory: docs + # destination-github-username: pinecone-io + # destination-repository-name: sdk-docs + # user-email: clients@pinecone.io + # target-branch: main + # target-directory: python + # commit-message: 'Python: automated documentation build - pinecone-python-client merge SHA: ${{ github.sha }}' diff --git a/README.md b/README.md index 01e4bbb1a..bc9d90710 100644 --- a/README.md +++ b/README.md @@ -28,36 +28,20 @@ pip3 install git+https://git@github.com/pinecone-io/pinecone-python-client.git@e pip3 install git+https://git@github.com/pinecone-io/pinecone-python-client.git@259deff ``` -## Create a client -The following example creates an authenticated client. - -```python -import os -from pinecone import Pinecone - -pc = Pinecone(api_key=os.environ.get('PINECONE_API_KEY')) -``` -To use gRPC for interacting with an index, instantiate with `PineconeGRPC` -```python -import os -from pinecone.grpc import PineconeGRPC - -pc = PineconeGRPC(api_key=os.environ.get('PINECONE_API_KEY')) -# Functionality matches non-gRPC client -index = pc.Index('index-name') -``` - -## Create an index +## Creating an index The following example creates an index without a metadata configuration. By default, Pinecone indexes all metadata. ```python -from pinecone import Pinecone, PodSpec -pc = Pinecone(api_key='<>') -pc.create_index("example-index", dimension=1536, metric="cosine", spec=PodSpec(environment='us-west-2', pod_type='p1.x1')) +import pinecone + +pinecone.init(api_key="YOUR_API_KEY", + environment="us-west1-gcp") + +pinecone.create_index("example-index", dimension=1024) ``` The following example creates an index that only indexes @@ -65,18 +49,12 @@ the "color" metadata field. Queries against this index cannot filter based on any other metadata field. ```python -from pinecone import Pinecone, PodSpec -pc = Pinecone(api_key='<>') - metadata_config = { "indexed": ["color"] } -pc.create_index( - "example-index-2", - dimension=1536, - spec=PodSpec(environment='us-west-2', pod_type='p1.x1', metadata_config=metadata_config) -) +pinecone.create_index("example-index-2", dimension=1024, + metadata_config=metadata_config) ``` ## List indexes @@ -84,11 +62,11 @@ pc.create_index( The following example returns all indexes in your project. ```python -from pinecone import Pinecone +import pinecone -pc = Pinecone(api_key='<>') -for index in pc.list_indexes(): - print(index['name']) +pinecone.init(api_key="YOUR_API_KEY", environment="us-west1-gcp") + +active_indexes = pinecone.list_indexes() ``` ## Describe index @@ -96,11 +74,12 @@ for index in pc.list_indexes(): The following example returns information about the index `example-index`. ```python -from pinecone import Pinecone +import pinecone + +pinecone.init(api_key="YOUR_API_KEY", environment="us-west1-gcp") -pc = Pinecone(api_key='<>') +index_description = pinecone.describe_index("example-index") -index_description = pc.describe_index("example-index") ``` ## Delete an index @@ -108,11 +87,11 @@ index_description = pc.describe_index("example-index") The following example deletes `example-index`. ```python -from pinecone import Pinecone +import pinecone -pc = Pinecone(api_key='<>') +pinecone.init(api_key="YOUR_API_KEY", environment="us-west1-gcp") -pc.delete_index("example-index") +pinecone.delete_index("example-index") ``` ## Scale replicas @@ -120,12 +99,12 @@ pc.delete_index("example-index") The following example changes the number of replicas for `example-index`. ```python -from pinecone import Pinecone +import pinecone -pc = Pinecone(api_key='<>') +pinecone.init(api_key="YOUR_API_KEY", environment="us-west1-gcp") new_number_of_replicas = 4 -pc.configure_index("example-index", replicas=new_number_of_replicas) +pinecone.configure_index("example-index", replicas=new_number_of_replicas) ``` ## Describe index statistics @@ -133,10 +112,10 @@ pc.configure_index("example-index", replicas=new_number_of_replicas) The following example returns statistics about the index `example-index`. ```python -from pinecone import Pinecone +import pinecone -pc = Pinecone(api_key='<>') -index = pc.Index("example-index") +pinecone.init(api_key="YOUR_API_KEY", environment="us-west1-gcp") +index = pinecone.Index("example-index") index_stats_response = index.describe_index_stats() ``` @@ -147,10 +126,10 @@ index_stats_response = index.describe_index_stats() The following example upserts vectors to `example-index`. ```python -from pinecone import Pinecone +import pinecone -pc = Pinecone(api_key='<>') -index = pc.Index("example-index") +pinecone.init(api_key="YOUR_API_KEY", environment="us-west1-gcp") +index = pinecone.Index("example-index") upsert_response = index.upsert( vectors=[ @@ -167,10 +146,10 @@ The following example queries the index `example-index` with metadata filtering. ```python -from pinecone import Pinecone +import pinecone -pc = Pinecone(api_key='<>') -index = pc.Index("example-index") +pinecone.init(api_key="YOUR_API_KEY", environment="us-west1-gcp") +index = pinecone.Index("example-index") query_response = index.query( namespace="example-namespace", @@ -189,10 +168,10 @@ query_response = index.query( The following example deletes vectors by ID. ```python -from pinecone import Pinecone +import pinecone -pc = Pinecone(api_key='<>') -index = pc.Index("example-index") +pinecone.init(api_key="YOUR_API_KEY", environment="us-west1-gcp") +index = pinecone.Index("example-index") delete_response = index.delete(ids=["vec1", "vec2"], namespace="example-namespace") ``` @@ -202,23 +181,24 @@ delete_response = index.delete(ids=["vec1", "vec2"], namespace="example-namespac The following example fetches vectors by ID. ```python -from pinecone import Pinecone +import pinecone -pc = Pinecone(api_key='<>') -index = pc.Index("example-index") +pinecone.init(api_key="YOUR_API_KEY", environment="us-west1-gcp") +index = pinecone.Index("example-index") fetch_response = index.fetch(ids=["vec1", "vec2"], namespace="example-namespace") ``` + ## Update vectors The following example updates vectors by ID. ```python -from pinecone import Pinecone +import pinecone -pc = Pinecone(api_key='<>') -index = pc.Index("example-index") +pinecone.init(api_key="YOUR_API_KEY", environment="us-west1-gcp") +index = pinecone.Index("example-index") update_response = index.update( id="vec1", @@ -234,11 +214,12 @@ The following example creates the collection `example-collection` from `example-index`. ```python -from pinecone import Pinecone +import pinecone -pc = Pinecone(api_key='<>') +pinecone.init(api_key="YOUR_API_KEY", + environment="us-west1-gcp") -pc.create_collection("example-collection", "example-index") +pinecone.create_collection("example-collection", "example-index") ``` ## List collections @@ -246,11 +227,11 @@ pc.create_collection("example-collection", "example-index") The following example returns a list of the collections in the current project. ```python -from pinecone import Pinecone +import pinecone -pc = Pinecone(api_key='<>') +pinecone.init(api_key="YOUR_API_KEY", environment="us-west1-gcp") -active_collections = pc.list_collections() +active_collections = pinecone.list_collections() ``` ## Describe a collection @@ -259,11 +240,11 @@ The following example returns a description of the collection `example-collection`. ```python -from pinecone import Pinecone +import pinecone -pc = Pinecone(api_key='<>') +pinecone.init(api_key="YOUR_API_KEY", environment="us-west1-gcp") -collection_description = pc.describe_collection("example-collection") +collection_description = pinecone.describe_collection("example-collection") ``` ## Delete a collection @@ -271,11 +252,11 @@ collection_description = pc.describe_collection("example-collection") The following example deletes the collection `example-collection`. ```python -from pinecone import Pinecone +import pinecone -pc = Pinecone(api_key='<>') +pinecone.init(api_key="YOUR_API_KEY", environment="us-west1-gcp") -pc.delete_collection("example-collection") +pinecone.delete_collection("example-collection") ``` # Contributing From 12de7aeb0d7db372e746bc1d7e20e67354911d31 Mon Sep 17 00:00:00 2001 From: Jennifer Hamon Date: Sat, 13 Jan 2024 17:26:26 -0500 Subject: [PATCH 23/42] Add missing certifi dependency (#277) ## Problem Recent integration testing with our published dev releases shows we are missing a dependency: `certifi`. ``` Traceback (most recent call last): File "/home/runner/work/pinecone-python-client/pinecone-python-client/scripts/3.x/delete-all-indexes.py", line 4, in from pinecone import Pinecone File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/pinecone/__init__.py", line 4, in from .config import * File "/opt/hostedtoolcache/Python/3.9.18/x[64](https://github.com/pinecone-io/pinecone-python-client/actions/runs/7514956364/job/20458392131#step:3:69)/lib/python3.9/site-packages/pinecone/config/__init__.py", line 4, in from .config import ConfigBuilder, Config File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/pinecone/config/config.py", line 5, in from pinecone.config.openapi import OpenApiConfigFactory File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/pinecone/config/openapi.py", line 4, in import certifi ModuleNotFoundError: No module named 'certifi' ``` ## Solution We need to declare a direct dependency on `certifi`, which is used when we setup configuration to get information about current SSL certs. We used to get this as a transitive dependency when we had a dependency on the `requests` package, but that was recently removed while pruning unused dependencies. The `certifi` package does not follow semver (versions are date based) and should ideally always be on the latest version. But since we are developing a library that needs broad compatibility we will specify a very broad range to be compatible with everyone's apps and other libraries that may be pinned to specific versions or narrow ranges. ## Type of Change - [x] Bug fix (non-breaking change which fixes an issue) ## Test Plan Need to build a new dev release and rerun install-based integration test. --- poetry.lock | 8 ++++---- pyproject.toml | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/poetry.lock b/poetry.lock index 86aabad9c..23efb4e9e 100644 --- a/poetry.lock +++ b/poetry.lock @@ -35,13 +35,13 @@ tests-no-zope = ["cloudpickle", "hypothesis", "mypy (>=1.1.1)", "pympler", "pyte [[package]] name = "certifi" -version = "2023.7.22" +version = "2023.11.17" description = "Python package for providing Mozilla's CA Bundle." optional = false python-versions = ">=3.6" files = [ - {file = "certifi-2023.7.22-py3-none-any.whl", hash = "sha256:92d6037539857d8206b8f6ae472e8b77db8058fec5937a1ef3f54304089edbb9"}, - {file = "certifi-2023.7.22.tar.gz", hash = "sha256:539cc1d13202e33ca466e88b2807e29f4c13049d6d87031a3c110744495cb082"}, + {file = "certifi-2023.11.17-py3-none-any.whl", hash = "sha256:e036ab49d5b79556f99cfc2d9320b34cfbe5be05c5871b51de9329f0603b0474"}, + {file = "certifi-2023.11.17.tar.gz", hash = "sha256:9b469f3a900bf28dc19b8cfbf8019bf47f7fdd1a65a1d4ffb98fc14166beb4d1"}, ] [[package]] @@ -1198,4 +1198,4 @@ grpc = ["googleapis-common-protos", "grpc-gateway-protoc-gen-openapiv2", "grpcio [metadata] lock-version = "2.0" python-versions = ">=3.8,<3.13" -content-hash = "9b463283ead14a000789fdc1d8ef0797759103b326dea21a2ae07083011ba2ad" +content-hash = "8c61e1d38e8f8a0e1bc3f770033707f04ccccbc5af91d6ec4972ab7b27127987" diff --git a/pyproject.toml b/pyproject.toml index d78660adb..06dcbc602 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -51,6 +51,10 @@ python = ">=3.8,<3.13" typing-extensions = ">=3.7.4" urllib3 = ">=1.26.0" tqdm = ">=4.64.1" +# certifi does not follow semver. Should always be +# on latest but setting a broad range to have maximum +# compatibility with libraries that may pin version. +certifi = ">=2019.11.17" grpcio = { version = ">=1.44.0", optional = true } grpc-gateway-protoc-gen-openapiv2 = { version = "0.1.0", optional = true } googleapis-common-protos = { version = ">=1.53.0", optional = true } From 01775d0462c691dd9191c6db0777cc607ca326cf Mon Sep 17 00:00:00 2001 From: Jennifer Hamon Date: Sat, 13 Jan 2024 19:43:59 -0500 Subject: [PATCH 24/42] Add missing .names() for list_collections() (#278) ## Problem The `list_indexes()` response has a convenience method that lets you easily get index names by chaining `.names()`. We want the same ergonomics on `list_collections()`. ## Solution Add test and adjust model for implementation. Now you should be able to do: ```python if index_name not in pc.list_indexes.names(): # this already was working if collection_name not in pc.list_collections.names(): # this is what got added in this diff ``` ## Type of Change - [x] New feature (non-breaking change which adds functionality) --- pinecone/models/collection_list.py | 3 +++ tests/unit/models/test_collection_list.py | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/pinecone/models/collection_list.py b/pinecone/models/collection_list.py index 64df1e57a..40fd88156 100644 --- a/pinecone/models/collection_list.py +++ b/pinecone/models/collection_list.py @@ -5,6 +5,9 @@ def __init__(self, collection_list: OpenAPICollectionList): self.collection_list = collection_list self.current = 0 + def names(self): + return [i['name'] for i in self.collection_list.collections] + def __getitem__(self, key): return self.collection_list.collections[key] diff --git a/tests/unit/models/test_collection_list.py b/tests/unit/models/test_collection_list.py index 3b26690f1..fea78f2b4 100644 --- a/tests/unit/models/test_collection_list.py +++ b/tests/unit/models/test_collection_list.py @@ -27,4 +27,11 @@ def test_collection_list_getitem(self, collection_list_response): def test_collection_list_proxies_methods(self, collection_list_response): # Forward compatibility, in case we add more attributes to IndexList for pagination - assert CollectionList(collection_list_response).collection_list.collections == collection_list_response.collections \ No newline at end of file + assert CollectionList(collection_list_response).collection_list.collections == collection_list_response.collections + + def test_when_results_are_empty(self): + assert len(CollectionList(OpenApiCollectionList(collections=[]))) == 0 + + def test_collection_list_names_syntactic_sugar(self, collection_list_response): + icl = CollectionList(collection_list_response) + assert icl.names() == ['collection1', 'collection2'] \ No newline at end of file From dea93dadb5e5adbad99aebbeab528b8f4b0d8551 Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Sat, 13 Jan 2024 20:18:43 -0500 Subject: [PATCH 25/42] Update generated class --- .../core/client/model/collection_model.py | 30 ++++++++----------- 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/pinecone/core/client/model/collection_model.py b/pinecone/core/client/model/collection_model.py index 4e9d54280..42992a404 100644 --- a/pinecone/core/client/model/collection_model.py +++ b/pinecone/core/client/model/collection_model.py @@ -91,10 +91,10 @@ def openapi_types(): """ return { 'name': (str,), # noqa: E501 - 'size': (int,), # noqa: E501 'status': (str,), # noqa: E501 + 'size': (int,), # noqa: E501 'dimension': (int,), # noqa: E501 - 'record_count': (int,), # noqa: E501 + 'vector_count': (int,), # noqa: E501 'environment': (str,), # noqa: E501 } @@ -105,10 +105,10 @@ def discriminator(): attribute_map = { 'name': 'name', # noqa: E501 - 'size': 'size', # noqa: E501 'status': 'status', # noqa: E501 + 'size': 'size', # noqa: E501 'dimension': 'dimension', # noqa: E501 - 'record_count': 'record_count', # noqa: E501 + 'vector_count': 'vector_count', # noqa: E501 'environment': 'environment', # noqa: E501 } @@ -119,15 +119,12 @@ def discriminator(): @classmethod @convert_js_args_to_python_args - def _from_openapi_data(cls, name, size, status, dimension, record_count, *args, **kwargs): # noqa: E501 + def _from_openapi_data(cls, name, status, *args, **kwargs): # noqa: E501 """CollectionModel - a model defined in OpenAPI Args: name (str): - size (int): The size of the collection in bytes. status (str): The status of the collection. - dimension (int): The dimension of the vectors stored in each record held in the collection - record_count (int): The number of records stored in the collection Keyword Args: _check_type (bool): if True, values for parameters in openapi_types @@ -160,6 +157,9 @@ def _from_openapi_data(cls, name, size, status, dimension, record_count, *args, Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) + size (int): The size of the collection in bytes.. [optional] # noqa: E501 + dimension (int): The dimension of the vectors stored in each record held in the collection. [optional] # noqa: E501 + vector_count (int): The number of records stored in the collection. [optional] # noqa: E501 environment (str): The environment where the collection is hosted.. [optional] # noqa: E501 """ @@ -189,10 +189,7 @@ def _from_openapi_data(cls, name, size, status, dimension, record_count, *args, self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.name = name - self.size = size self.status = status - self.dimension = dimension - self.record_count = record_count for var_name, var_value in kwargs.items(): if var_name not in self.attribute_map and \ self._configuration is not None and \ @@ -213,15 +210,12 @@ def _from_openapi_data(cls, name, size, status, dimension, record_count, *args, ]) @convert_js_args_to_python_args - def __init__(self, name, size, status, dimension, record_count, *args, **kwargs): # noqa: E501 + def __init__(self, name, status, *args, **kwargs): # noqa: E501 """CollectionModel - a model defined in OpenAPI Args: name (str): - size (int): The size of the collection in bytes. status (str): The status of the collection. - dimension (int): The dimension of the vectors stored in each record held in the collection - record_count (int): The number of records stored in the collection Keyword Args: _check_type (bool): if True, values for parameters in openapi_types @@ -254,6 +248,9 @@ def __init__(self, name, size, status, dimension, record_count, *args, **kwargs) Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) + size (int): The size of the collection in bytes.. [optional] # noqa: E501 + dimension (int): The dimension of the vectors stored in each record held in the collection. [optional] # noqa: E501 + vector_count (int): The number of records stored in the collection. [optional] # noqa: E501 environment (str): The environment where the collection is hosted.. [optional] # noqa: E501 """ @@ -281,10 +278,7 @@ def __init__(self, name, size, status, dimension, record_count, *args, **kwargs) self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.name = name - self.size = size self.status = status - self.dimension = dimension - self.record_count = record_count for var_name, var_value in kwargs.items(): if var_name not in self.attribute_map and \ self._configuration is not None and \ From 781e1087b79081c61d2cf4fbec8a56f401f7c446 Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Sat, 13 Jan 2024 20:49:30 -0500 Subject: [PATCH 26/42] Bump to .dev10 --- .github/actions/delete-all-collections/action.yml | 3 +-- .github/actions/test-collection/action.yml | 3 +-- .github/actions/test-legacy-index/action.yml | 3 +-- .github/workflows/testing-migration.yaml | 2 +- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/actions/delete-all-collections/action.yml b/.github/actions/delete-all-collections/action.yml index b03645e8d..39439feed 100644 --- a/.github/actions/delete-all-collections/action.yml +++ b/.github/actions/delete-all-collections/action.yml @@ -4,8 +4,7 @@ description: 'Delete all collections owned by API key' inputs: pinecone_client_version: description: 'The version of the Pinecone client to use' - required: false - default: '3.0.0.dev9' + required: true PINECONE_API_KEY: description: 'The Pinecone API key' required: true diff --git a/.github/actions/test-collection/action.yml b/.github/actions/test-collection/action.yml index 79ab92fd0..a8a96e408 100644 --- a/.github/actions/test-collection/action.yml +++ b/.github/actions/test-collection/action.yml @@ -4,8 +4,7 @@ description: 'Uses new client to interact with collection created via legacy cli inputs: pinecone_client_version: description: 'The version of the Pinecone client to use' - required: false - default: '3.0.0.dev9' + required: true collection_name: description: 'The name of the collection' required: true diff --git a/.github/actions/test-legacy-index/action.yml b/.github/actions/test-legacy-index/action.yml index f02b3a8d0..4258d6e67 100644 --- a/.github/actions/test-legacy-index/action.yml +++ b/.github/actions/test-legacy-index/action.yml @@ -4,8 +4,7 @@ description: 'Uses new client to interact with index created via legacy client' inputs: pinecone_client_version: description: 'The version of the Pinecone client to use' - required: false - default: '3.0.0.dev9' + required: true index_name: description: 'The name of the index' required: true diff --git a/.github/workflows/testing-migration.yaml b/.github/workflows/testing-migration.yaml index 1485ba0e4..6b46adaa3 100644 --- a/.github/workflows/testing-migration.yaml +++ b/.github/workflows/testing-migration.yaml @@ -9,7 +9,7 @@ env: DIMENSION: 1536 METRIC: cosine LEGACY_CLIENT_VERSION: 2.2.4 - NEW_CLIENT_VERSION: 3.0.0.dev9 + NEW_CLIENT_VERSION: 3.0.0.dev10 jobs: create-index-legacy-paid: From fad95b09db3eef5e7ffebf4a6c2e272ab6798828 Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Sat, 13 Jan 2024 22:14:42 -0500 Subject: [PATCH 27/42] Update collectioni creation --- .github/workflows/testing-migration.yaml | 2 +- scripts/2.x/create-collection-legacy.py | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/testing-migration.yaml b/.github/workflows/testing-migration.yaml index 6b46adaa3..7ac49b767 100644 --- a/.github/workflows/testing-migration.yaml +++ b/.github/workflows/testing-migration.yaml @@ -69,7 +69,7 @@ jobs: PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} PINECONE_ENVIRONMENT: ${{ matrix.env }} pinecone_client_version: ${{ env.LEGACY_CLIENT_VERSION }} - collection_name: py-migration-collection + collection_name_prefix: py-coll index_name: ${{ steps.create-legacy.outputs.index_name }} - name: Inspect collection (new) diff --git a/scripts/2.x/create-collection-legacy.py b/scripts/2.x/create-collection-legacy.py index 9e0a0cde6..56f22239c 100644 --- a/scripts/2.x/create-collection-legacy.py +++ b/scripts/2.x/create-collection-legacy.py @@ -45,23 +45,25 @@ def main(): print(f'Waiting for collection {collection_name} to be ready...') collection_ready = False - max_wait = 120 - while not collection_ready and max_wait >= 0: + max_wait = 10*60 + waited = 0 + while not collection_ready and waited <= max_wait: try: + waited += 10 collection_description = pinecone.describe_collection(collection_name) print(f'Collection description: {collection_description}') - if collection_description['status'] == 'Ready': + if collection_description.status == 'Ready': collection_ready = True else: - print(f'Collection {collection_name} not ready yet. Waiting...') - max_wait -= 10 - time.sleep(10) + print(f'Collection {collection_name} not after {waited} seconds. Waiting...') except Exception as e: print(f'Error while polling for collection {collection_name} status: {e}') - time.sleep(10) + time.sleep(10) if not collection_ready: raise Exception(f'Collection {collection_name} not ready after waiting for {max_wait} seconds.') + else: + print(f'Collection {collection_name} ready after waiting for {max_wait} seconds.') if __name__ == '__main__': main() \ No newline at end of file From 84068c030ddc082d7c9a00bddd6f0f2ab7aa6a39 Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Sat, 13 Jan 2024 22:15:35 -0500 Subject: [PATCH 28/42] Temp disable other tests --- .github/workflows/pr.yaml | 50 +++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 34d27ff82..f0cadee2b 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -11,31 +11,31 @@ jobs: migration-tests: uses: './.github/workflows/testing-migration.yaml' secrets: inherit - unit-tests: - uses: './.github/workflows/testing-unit.yaml' - secrets: inherit - integration-tests: - uses: './.github/workflows/testing-integration.yaml' - secrets: inherit - dependency-tests: - uses: './.github/workflows/testing-dependency.yaml' - secrets: inherit - package: - name: Check packaging - runs-on: ubuntu-latest - strategy: - matrix: - python-version: [3.8, 3.9, '3.10', 3.11] - steps: - - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Poetry - uses: ./.github/actions/setup-poetry - - name: Package - run: poetry build + # unit-tests: + # uses: './.github/workflows/testing-unit.yaml' + # secrets: inherit + # integration-tests: + # uses: './.github/workflows/testing-integration.yaml' + # secrets: inherit + # dependency-tests: + # uses: './.github/workflows/testing-dependency.yaml' + # secrets: inherit + # package: + # name: Check packaging + # runs-on: ubuntu-latest + # strategy: + # matrix: + # python-version: [3.8, 3.9, '3.10', 3.11] + # steps: + # - uses: actions/checkout@v4 + # - name: Set up Python ${{ matrix.python-version }} + # uses: actions/setup-python@v4 + # with: + # python-version: ${{ matrix.python-version }} + # - name: Setup Poetry + # uses: ./.github/actions/setup-poetry + # - name: Package + # run: poetry build build-docs: name: Build docs with pdoc From c7a57cbc45235f9f9371a7496901930717a04362 Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Sat, 13 Jan 2024 22:54:00 -0500 Subject: [PATCH 29/42] Fix collection create --- scripts/2.x/create-collection-legacy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/2.x/create-collection-legacy.py b/scripts/2.x/create-collection-legacy.py index 56f22239c..6b5af5984 100644 --- a/scripts/2.x/create-collection-legacy.py +++ b/scripts/2.x/create-collection-legacy.py @@ -63,7 +63,7 @@ def main(): if not collection_ready: raise Exception(f'Collection {collection_name} not ready after waiting for {max_wait} seconds.') else: - print(f'Collection {collection_name} ready after waiting for {max_wait} seconds.') + print(f'Collection {collection_name} ready after waiting for {waited} seconds.') if __name__ == '__main__': main() \ No newline at end of file From 99de680f0733a91d9427a13102e65e01f8d7caa9 Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Sat, 13 Jan 2024 23:11:09 -0500 Subject: [PATCH 30/42] Move env matrix to workflow level --- .github/workflows/pr.yaml | 24 +++++++ .github/workflows/testing-migration.yaml | 86 ++++++++++++------------ 2 files changed, 68 insertions(+), 42 deletions(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index f0cadee2b..7a722c8cf 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -9,8 +9,32 @@ on: jobs: migration-tests: + strategy: + matrix: + test-env: + - asia-southeast1-gcp + - asia-northeast1-gcp + - eu-west1-gcp + - eu-west4-gcp + - northamerica-northeast1-gcp + - us-central1-gcp + - us-east1-gcp + - us-east4-gcp + - us-west1-gcp + - us-west4-gcp + - eastus-azure + - us-east-1-aws + + # - gcp-starter + # - asia-southeast1-gcp-free + # - us-west1-gcp-free + # - us-west4-gcp-free + + uses: './.github/workflows/testing-migration.yaml' secrets: inherit + with: + environment: ${{ matrix.test-env }} # unit-tests: # uses: './.github/workflows/testing-unit.yaml' # secrets: inherit diff --git a/.github/workflows/testing-migration.yaml b/.github/workflows/testing-migration.yaml index 7ac49b767..9ca12b33c 100644 --- a/.github/workflows/testing-migration.yaml +++ b/.github/workflows/testing-migration.yaml @@ -2,8 +2,13 @@ name: 'Migration Tests' on: workflow_dispatch: {} - workflow_call: {} - + workflow_call: + inputs: + environment: + description: 'Environment to test' + required: true + type: string + env: NUM_VECTORS: 1000 DIMENSION: 1536 @@ -12,78 +17,75 @@ env: NEW_CLIENT_VERSION: 3.0.0.dev10 jobs: - create-index-legacy-paid: - name: Migration testing + create-index: + name: Create index runs-on: ubuntu-latest - strategy: - matrix: - env: - - asia-southeast1-gcp - - asia-northeast1-gcp - - eu-west1-gcp - - eu-west4-gcp - - northamerica-northeast1-gcp - - us-central1-gcp - - us-east1-gcp - - us-east4-gcp - - us-west1-gcp - - us-west4-gcp - - eastus-azure - - us-east-1-aws - - # - gcp-starter - # - asia-southeast1-gcp-free - # - us-west1-gcp-free - # - us-west4-gcp-free - - + outputs: + index_name: ${{ steps.create-legacy.outputs.index_name }} steps: - name: Checkout uses: actions/checkout@v4 - - name: Create index and upsert (legacy) id: create-legacy uses: ./.github/actions/create-index-legacy with: PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} - PINECONE_ENVIRONMENT: ${{ matrix.env }} + PINECONE_ENVIRONMENT: ${{ inputs.environment }} pinecone_client_version: ${{ env.LEGACY_CLIENT_VERSION }} index_name_prefix: py-migration dimension: ${{ env.DIMENSION }} metric: ${{ env.METRIC }} vectors_to_upsert: ${{ ENV.NUM_VECTORS }} - - name: Test index (GCPS) - id: inspect-gcps - uses: ./.github/actions/test-legacy-index - with: - PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} - PINECONE_ENVIRONMENT: ${{ matrix.env }} - pinecone_client_version: ${{ env.NEW_CLIENT_VERSION }} - index_name: ${{ steps.create-legacy.outputs.index_name }} + test-index-new: + needs: [create-index] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Test index (GCPS) + id: inspect-gcps + uses: ./.github/actions/test-legacy-index + with: + PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} + PINECONE_ENVIRONMENT: ${{ inputs.environment }} + pinecone_client_version: ${{ env.NEW_CLIENT_VERSION }} + index_name: ${{ needs.create-index.outputs.index_name }} + create-collection: + needs: [create-index] + runs-on: ubuntu-latest + outputs: + collection_name: ${{ steps.create-collection-legacy.outputs.collection_name }} + steps: + - name: Checkout + uses: actions/checkout@v4 - name: Create collection (legacy) id: create-collection-legacy uses: ./.github/actions/create-collection-legacy with: PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} - PINECONE_ENVIRONMENT: ${{ matrix.env }} + PINECONE_ENVIRONMENT: ${{ inputs.environment }} pinecone_client_version: ${{ env.LEGACY_CLIENT_VERSION }} collection_name_prefix: py-coll - index_name: ${{ steps.create-legacy.outputs.index_name }} + index_name: ${{ needs.create-index.outputs.index_name }} + test-collection-new: + needs: [create-collection] + runs-on: ubuntu-latest + steps: - name: Inspect collection (new) id: inspect-collection-new uses: ./.github/actions/test-collection with: PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} - PINECONE_ENVIRONMENT: ${{ matrix.env }} + PINECONE_ENVIRONMENT: ${{ inputs.environment }} pinecone_client_version: ${{ env.NEW_CLIENT_VERSION }} - collection_name: ${{ steps.create-collection-legacy.outputs.collection_name }} + collection_name: ${{ needs.create-collection.outputs.collection_name }} cleanup-indexes: if: always() - needs: [create-index-legacy-paid] + needs: [test-index-new] runs-on: ubuntu-latest steps: - name: Checkout @@ -96,7 +98,7 @@ jobs: cleanup-collections: if: always() - needs: [create-index-legacy-paid] + needs: [test-collection-new] runs-on: ubuntu-latest steps: - name: Checkout From 87c2bd43e19a56aff7286b63321198ece5e046c5 Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Sat, 13 Jan 2024 23:42:09 -0500 Subject: [PATCH 31/42] Change cleanup so envs can run independently --- .github/actions/delete-collection/action.yml | 19 +++++++++++++++++++ .github/workflows/pr.yaml | 13 +++++++++++++ .github/workflows/testing-migration.yaml | 18 +++++++++--------- 3 files changed, 41 insertions(+), 9 deletions(-) create mode 100644 .github/actions/delete-collection/action.yml diff --git a/.github/actions/delete-collection/action.yml b/.github/actions/delete-collection/action.yml new file mode 100644 index 000000000..4647639e0 --- /dev/null +++ b/.github/actions/delete-collection/action.yml @@ -0,0 +1,19 @@ +name: 'Delete Collection' +description: 'Deletes a collection' + +inputs: + collection_name: + description: 'The name of the collection to delete' + required: true + PINECONE_API_KEY: + description: 'The Pinecone API key' + required: true + + +runs: + using: 'composite' + steps: + - name: Delete collection + shell: bash + run: | + curl -X DELETE "https://api.pinecone.io/collections/${{ inputs.collection_name }}" -H "Api-Key: ${{ inputs.PINECONE_API_KEY }}" diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 7a722c8cf..e8aeef139 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -35,6 +35,19 @@ jobs: secrets: inherit with: environment: ${{ matrix.test-env }} + + cleanup-indexes: + if: always() + needs: [migration-tests] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Delete all indexes + uses: ./.github/actions/delete-all-indexes + with: + PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} + pinecone_client_version: 3.0.0.dev10 # unit-tests: # uses: './.github/workflows/testing-unit.yaml' # secrets: inherit diff --git a/.github/workflows/testing-migration.yaml b/.github/workflows/testing-migration.yaml index 9ca12b33c..e673ade2c 100644 --- a/.github/workflows/testing-migration.yaml +++ b/.github/workflows/testing-migration.yaml @@ -37,7 +37,7 @@ jobs: metric: ${{ env.METRIC }} vectors_to_upsert: ${{ ENV.NUM_VECTORS }} - test-index-new: + test-index-gcps: needs: [create-index] runs-on: ubuntu-latest steps: @@ -83,28 +83,28 @@ jobs: pinecone_client_version: ${{ env.NEW_CLIENT_VERSION }} collection_name: ${{ needs.create-collection.outputs.collection_name }} - cleanup-indexes: + cleanup-index: if: always() - needs: [test-index-new] + needs: [test-index-gcps, create-index] runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Delete all indexes - uses: ./.github/actions/delete-all-indexes + uses: ./.github/actions/delete-index with: PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} - pinecone_client_version: ${{ env.NEW_CLIENT_VERSION }} + index_name: ${{ needs.create-index.outputs.index_name }} - cleanup-collections: + cleanup-collection: if: always() - needs: [test-collection-new] + needs: [test-collection-new, create-collection] runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - - name: Delete all collections + - name: Delete collection uses: ./.github/actions/delete-all-collections with: PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} - pinecone_client_version: ${{ env.NEW_CLIENT_VERSION }} \ No newline at end of file + collection_name: ${{ needs.create-collection.outputs.collection_name }} \ No newline at end of file From c9b515d6de4228a8a829d55d11a03c789048c65b Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Sat, 13 Jan 2024 23:57:53 -0500 Subject: [PATCH 32/42] Do not fail fast when workflows fail --- .github/workflows/pr.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index e8aeef139..e355afdb9 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -10,6 +10,7 @@ on: jobs: migration-tests: strategy: + fail-fast: false matrix: test-env: - asia-southeast1-gcp From f53fd99760403475cd2808f7c5eefb91367c0acd Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Sun, 14 Jan 2024 00:03:51 -0500 Subject: [PATCH 33/42] Add missing checkout step --- .github/workflows/testing-migration.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/testing-migration.yaml b/.github/workflows/testing-migration.yaml index e673ade2c..24aab170f 100644 --- a/.github/workflows/testing-migration.yaml +++ b/.github/workflows/testing-migration.yaml @@ -74,6 +74,8 @@ jobs: needs: [create-collection] runs-on: ubuntu-latest steps: + - name: Checkout + uses: actions/checkout@v4 - name: Inspect collection (new) id: inspect-collection-new uses: ./.github/actions/test-collection From a38f2ec4f33b06e6ff353be6e766bdef97744fc6 Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Sun, 14 Jan 2024 00:31:46 -0500 Subject: [PATCH 34/42] Cleanup any collections left after all mgiration testing is done --- .github/workflows/pr.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index e355afdb9..ab5910783 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -49,6 +49,20 @@ jobs: with: PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} pinecone_client_version: 3.0.0.dev10 + + cleanup-collections: + if: always() + needs: [migration-tests] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Delete all collections + uses: ./.github/actions/delete-all-collections + with: + PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} + pinecone_client_version: 3.0.0.dev10 + # unit-tests: # uses: './.github/workflows/testing-unit.yaml' # secrets: inherit From a4f4a95e9d05bc8af42d62ac679f1b19f73be4b6 Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Sun, 14 Jan 2024 00:47:00 -0500 Subject: [PATCH 35/42] Cleanup collection after test run --- .github/workflows/testing-migration.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/testing-migration.yaml b/.github/workflows/testing-migration.yaml index 24aab170f..27033b3b6 100644 --- a/.github/workflows/testing-migration.yaml +++ b/.github/workflows/testing-migration.yaml @@ -106,7 +106,7 @@ jobs: - name: Checkout uses: actions/checkout@v4 - name: Delete collection - uses: ./.github/actions/delete-all-collections + uses: ./.github/actions/delete-collections with: PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} - collection_name: ${{ needs.create-collection.outputs.collection_name }} \ No newline at end of file + collection_name: ${{ needs.create-collection.outputs.collection_name }} From 3899c436454f0d8d786b03eea09fd5bec35bea86 Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Sun, 14 Jan 2024 00:52:25 -0500 Subject: [PATCH 36/42] Fix delete-collection path --- .github/workflows/testing-migration.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/testing-migration.yaml b/.github/workflows/testing-migration.yaml index 27033b3b6..53e2463a5 100644 --- a/.github/workflows/testing-migration.yaml +++ b/.github/workflows/testing-migration.yaml @@ -106,7 +106,7 @@ jobs: - name: Checkout uses: actions/checkout@v4 - name: Delete collection - uses: ./.github/actions/delete-collections + uses: ./.github/actions/delete-collection with: PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} collection_name: ${{ needs.create-collection.outputs.collection_name }} From ec76cea1fdc056d109558b4706da42b24202b11c Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Sun, 14 Jan 2024 01:12:39 -0500 Subject: [PATCH 37/42] Remove azure from matrix --- .github/workflows/pr.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index ab5910783..a300c1c65 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -23,7 +23,7 @@ jobs: - us-east4-gcp - us-west1-gcp - us-west4-gcp - - eastus-azure + # - eastus-azure - us-east-1-aws # - gcp-starter From 97a980b8a2f898d9da2cf365a7e85d60740da2ee Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Sun, 14 Jan 2024 02:54:32 -0500 Subject: [PATCH 38/42] Add create-from-collection --- .../create-index-from-collection/action.yml | 58 ++++++++++++++++++ .github/workflows/testing-migration.yaml | 38 +++++++++++- .../3.x/create-pod-index-from-collection.py | 60 +++++++++++++++++++ scripts/3.x/test-collection.py | 2 + 4 files changed, 155 insertions(+), 3 deletions(-) create mode 100644 .github/actions/create-index-from-collection/action.yml create mode 100644 scripts/3.x/create-pod-index-from-collection.py diff --git a/.github/actions/create-index-from-collection/action.yml b/.github/actions/create-index-from-collection/action.yml new file mode 100644 index 000000000..0190a2a8b --- /dev/null +++ b/.github/actions/create-index-from-collection/action.yml @@ -0,0 +1,58 @@ +name: 'Create Index from Collection' +description: 'Creates a pod index from a collection' + +inputs: + index_name_prefix: + description: 'The prefix of the index name' + required: false + default: 'index-name' + collection_name: + description: 'The name of the collection to make the index from' + required: true + PINECONE_API_KEY: + description: 'The Pinecone API key' + required: true + PINECONE_ENVIRONMENT: + description: 'The environment of the collection' + required: true + dimension: + description: 'The dimension of the index' + required: false + default: '3' + metric: + description: 'The metric of the index' + required: false + default: 'cosine' + expected_vector_count: + description: 'The expected number of vectors in the index' + required: false + +outputs: + index_name: + description: 'The name of the index, including randomized suffix' + value: ${{ steps.create-index.outputs.index_name }} + +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: Create index + id: create-index + shell: bash + run: poetry run python3 scripts/3.x/create-pod-index-from-collection.py + env: + PINECONE_API_KEY: ${{ inputs.PINECONE_API_KEY }} + PINECONE_ENVIRONMENT: ${{ inputs.PINECONE_ENVIRONMENT }} + INDEX_NAME_PREFIX: ${{ inputs.index_name_prefix }} + COLLECTION_NAME: ${{ inputs.collection_name }} + DIMENSION: ${{ inputs.dimension }} + METRIC: ${{ inputs.metric }} + EXPECTED_VECTOR_COUNT: ${{ inputs.expected_vector_count }} + diff --git a/.github/workflows/testing-migration.yaml b/.github/workflows/testing-migration.yaml index 53e2463a5..d00b8c440 100644 --- a/.github/workflows/testing-migration.yaml +++ b/.github/workflows/testing-migration.yaml @@ -85,9 +85,9 @@ jobs: pinecone_client_version: ${{ env.NEW_CLIENT_VERSION }} collection_name: ${{ needs.create-collection.outputs.collection_name }} - cleanup-index: + cleanup-first-index: if: always() - needs: [test-index-gcps, create-index] + needs: [test-index-gcps, create-index, create-collection] runs-on: ubuntu-latest steps: - name: Checkout @@ -97,10 +97,42 @@ jobs: with: PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} index_name: ${{ needs.create-index.outputs.index_name }} + + create-index-from-collection-new: + needs: [create-collection] + runs-on: ubuntu-latest + outputs: + index_name: ${{ steps.create-index-from-collection.outputs.index_name }} + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Create index from collection + id: create-index-from-collection + uses: ./.github/actions/create-index-from-collection + with: + PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} + PINECONE_ENVIRONMENT: ${{ inputs.environment }} + pinecone_client_version: ${{ env.NEW_CLIENT_VERSION }} + index_name_prefix: py-migration + collection_name: ${{ needs.create-collection.outputs.collection_name }} + expected_vector_count: ${{ env.NUM_VECTORS }} + + cleanup-second-index: + if: always() + needs: [create-index-from-collection-new] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Delete all indexes + uses: ./.github/actions/delete-index + with: + PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} + index_name: ${{ needs.create-index-from-collection-new.outputs.index_name }} cleanup-collection: if: always() - needs: [test-collection-new, create-collection] + needs: [test-collection-new, create-collection, create-index-from-collection-new] runs-on: ubuntu-latest steps: - name: Checkout diff --git a/scripts/3.x/create-pod-index-from-collection.py b/scripts/3.x/create-pod-index-from-collection.py new file mode 100644 index 000000000..d1fa6b15c --- /dev/null +++ b/scripts/3.x/create-pod-index-from-collection.py @@ -0,0 +1,60 @@ +import os +import random +import string +import time +from pinecone import Pinecone + +def read_env_var(name): + value = os.environ.get(name) + if value is None: + raise 'Environment variable {} is not set'.format(name) + return value + +def random_string(length): + return ''.join(random.choice(string.ascii_lowercase) for i in range(length)) + +def write_gh_output(name, value): + with open(os.environ['GITHUB_OUTPUT'], 'a') as fh: + print(f'{name}={value}', file=fh) + +def main(): + environment = read_env_var('PINECONE_ENVIRONMENT') + pc = Pinecone(api_key=read_env_var('PINECONE_API_KEY')) + environment = read_env_var('PINECONE_ENVIRONMENT') + collection_name = read_env_var('COLLECTION_NAME_PREFIX') + + index_name = read_env_var('INDEX_NAME_PREFIX') + '-from-' + collection_name + + pc.create_index( + name=index_name, + metric=read_env_var('METRIC'), + dimension=int(read_env_var('DIMENSION')), + spec={ + 'pod': { + 'environment': environment, + 'source_collection': collection_name, + 'pod_type': 'p1' + } + } + ) + write_gh_output('index_name', index_name) + time.sleep(60) + + description = pc.describe_index(index_name) + print(f'Index description: {description}') + assert description.name == index_name + + assert description.status.state == 'Ready' + assert description.status.ready == True + + idx = pc.Index(name=index_name) + stats = idx.describe_index_stats() + print(f'Index stats: {stats}') + + assert stats.dimension == int(read_env_var('DIMENSION')) + assert stats.metric == read_env_var('METRIC') + assert stats.total_vector_count == read_env_var('TOTAL_VECTOR_COUNT') + +if __name__ == '__main__': + main() + diff --git a/scripts/3.x/test-collection.py b/scripts/3.x/test-collection.py index 204a7493c..e9fc01dbf 100644 --- a/scripts/3.x/test-collection.py +++ b/scripts/3.x/test-collection.py @@ -25,6 +25,8 @@ def main(): description = pc.describe_collection(collection_name) print(f'Collection description: {description}') + assert description.name == collection_name + assert description['status'] == 'Ready' From 1814823c3a0d52134d4ee160e3b3626707ff8b0d Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Sun, 14 Jan 2024 03:06:39 -0500 Subject: [PATCH 39/42] Add create-from-collection --- .github/actions/create-index-pod/action.yml | 60 ++++++++ .../workflows/testing-reverse-migration.yml | 144 ++++++++++++++++++ scripts/3.x/create-pod-index.py | 71 +++++++++ 3 files changed, 275 insertions(+) create mode 100644 .github/actions/create-index-pod/action.yml create mode 100644 .github/workflows/testing-reverse-migration.yml create mode 100644 scripts/3.x/create-pod-index.py diff --git a/.github/actions/create-index-pod/action.yml b/.github/actions/create-index-pod/action.yml new file mode 100644 index 000000000..97f7521cd --- /dev/null +++ b/.github/actions/create-index-pod/action.yml @@ -0,0 +1,60 @@ +name: 'Create Pod Index via GCPS' +description: 'Creates an index to be used in other tests' + +inputs: + pinecone_client_version: + description: 'The version of the Pinecone client to use' + required: false + default: '3.0.0.dev10' + index_name_prefix: + description: 'The prefix for index names' + required: true + dimension: + description: 'The dimension of the index' + required: false + default: '1536' + metric: + description: 'The metric of the index' + required: false + default: 'cosine' + vectors_to_upsert: + description: 'The number of vectors to upsert' + required: false + default: '1000' + PINECONE_ENVIRONMENT: + description: 'The environment of the index' + required: true + PINECONE_API_KEY: + description: 'The Pinecone API key' + required: true + +outputs: + index_name: + description: 'The name of the index, including randomized suffix' + value: ${{ steps.create-index.outputs.index_name }} + +runs: + using: 'composite' + steps: + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: 3.9 + + - name: Install pinecone-client + shell: bash + run: | + pip install pinecone-client==${{ inputs.pinecone_client_version }} + + - name: Create index + id: create-index + shell: bash + run: python3 scripts/3.x/create-pod-index.py + env: + PINECONE_API_KEY: ${{ inputs.PINECONE_API_KEY }} + PINECONE_ENVIRONMENT: ${{ inputs.PINECONE_ENVIRONMENT }} + INDEX_NAME_PREFIX: ${{ inputs.index_name_prefix }} + DIMENSION: ${{ inputs.dimension }} + METRIC: ${{ inputs.metric }} + VECTORS_TO_UPSERT: ${{ inputs.vectors_to_upsert }} + diff --git a/.github/workflows/testing-reverse-migration.yml b/.github/workflows/testing-reverse-migration.yml new file mode 100644 index 000000000..d00b8c440 --- /dev/null +++ b/.github/workflows/testing-reverse-migration.yml @@ -0,0 +1,144 @@ +name: 'Migration Tests' + +on: + workflow_dispatch: {} + workflow_call: + inputs: + environment: + description: 'Environment to test' + required: true + type: string + +env: + NUM_VECTORS: 1000 + DIMENSION: 1536 + METRIC: cosine + LEGACY_CLIENT_VERSION: 2.2.4 + NEW_CLIENT_VERSION: 3.0.0.dev10 + +jobs: + create-index: + name: Create index + runs-on: ubuntu-latest + outputs: + index_name: ${{ steps.create-legacy.outputs.index_name }} + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Create index and upsert (legacy) + id: create-legacy + uses: ./.github/actions/create-index-legacy + with: + PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} + PINECONE_ENVIRONMENT: ${{ inputs.environment }} + pinecone_client_version: ${{ env.LEGACY_CLIENT_VERSION }} + index_name_prefix: py-migration + dimension: ${{ env.DIMENSION }} + metric: ${{ env.METRIC }} + vectors_to_upsert: ${{ ENV.NUM_VECTORS }} + + test-index-gcps: + needs: [create-index] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Test index (GCPS) + id: inspect-gcps + uses: ./.github/actions/test-legacy-index + with: + PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} + PINECONE_ENVIRONMENT: ${{ inputs.environment }} + pinecone_client_version: ${{ env.NEW_CLIENT_VERSION }} + index_name: ${{ needs.create-index.outputs.index_name }} + + create-collection: + needs: [create-index] + runs-on: ubuntu-latest + outputs: + collection_name: ${{ steps.create-collection-legacy.outputs.collection_name }} + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Create collection (legacy) + id: create-collection-legacy + uses: ./.github/actions/create-collection-legacy + with: + PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} + PINECONE_ENVIRONMENT: ${{ inputs.environment }} + pinecone_client_version: ${{ env.LEGACY_CLIENT_VERSION }} + collection_name_prefix: py-coll + index_name: ${{ needs.create-index.outputs.index_name }} + + test-collection-new: + needs: [create-collection] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Inspect collection (new) + id: inspect-collection-new + uses: ./.github/actions/test-collection + with: + PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} + PINECONE_ENVIRONMENT: ${{ inputs.environment }} + pinecone_client_version: ${{ env.NEW_CLIENT_VERSION }} + collection_name: ${{ needs.create-collection.outputs.collection_name }} + + cleanup-first-index: + if: always() + needs: [test-index-gcps, create-index, create-collection] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Delete all indexes + uses: ./.github/actions/delete-index + with: + PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} + index_name: ${{ needs.create-index.outputs.index_name }} + + create-index-from-collection-new: + needs: [create-collection] + runs-on: ubuntu-latest + outputs: + index_name: ${{ steps.create-index-from-collection.outputs.index_name }} + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Create index from collection + id: create-index-from-collection + uses: ./.github/actions/create-index-from-collection + with: + PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} + PINECONE_ENVIRONMENT: ${{ inputs.environment }} + pinecone_client_version: ${{ env.NEW_CLIENT_VERSION }} + index_name_prefix: py-migration + collection_name: ${{ needs.create-collection.outputs.collection_name }} + expected_vector_count: ${{ env.NUM_VECTORS }} + + cleanup-second-index: + if: always() + needs: [create-index-from-collection-new] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Delete all indexes + uses: ./.github/actions/delete-index + with: + PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} + index_name: ${{ needs.create-index-from-collection-new.outputs.index_name }} + + cleanup-collection: + if: always() + needs: [test-collection-new, create-collection, create-index-from-collection-new] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Delete collection + uses: ./.github/actions/delete-collection + with: + PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} + collection_name: ${{ needs.create-collection.outputs.collection_name }} diff --git a/scripts/3.x/create-pod-index.py b/scripts/3.x/create-pod-index.py new file mode 100644 index 000000000..56dacbc09 --- /dev/null +++ b/scripts/3.x/create-pod-index.py @@ -0,0 +1,71 @@ +import os +import random +import string +import time +from pinecone import Pinecone + +def read_env_var(name): + value = os.environ.get(name) + if value is None: + raise 'Environment variable {} is not set'.format(name) + return value + +def random_string(length): + return ''.join(random.choice(string.ascii_lowercase) for i in range(length)) + +def random_embedding_values(dimension=2): + return [random.random() for _ in range(dimension)] + +def write_gh_output(name, value): + with open(os.environ['GITHUB_OUTPUT'], 'a') as fh: + print(f'{name}={value}', file=fh) + +def main(): + environment = read_env_var('PINECONE_ENVIRONMENT') + pc = Pinecone(api_key=read_env_var('PINECONE_API_KEY')) + environment = read_env_var('PINECONE_ENVIRONMENT') + vectors_to_upsert = int(read_env_var('VECTORS_TO_UPSERT')) + + index_name = read_env_var('INDEX_NAME_PREFIX') + random_string(10) + pc.create_index( + name=index_name, + metric=read_env_var('METRIC'), + dimension=int(read_env_var('DIMENSION')), + spec={ + 'pod': { + 'environment': environment, + 'source_collection': collection_name, + 'pod_type': 'p1' + } + } + ) + write_gh_output('index_name', index_name) + time.sleep(60) # More waiting, just in case + + description = pc.describe_index(index_name) + print(f'Index description: {description}') + assert description.name == index_name + + assert description.status.state == 'Ready' + assert description.status.ready == True + + idx = pc.Index(name=index_name) + stats = idx.describe_index_stats() + print(f'Index stats: {stats}') + + print(f'Beginning upsert of {vectors_to_upsert} vectors to index {index_name}...') + batch_size = 10 + num_batches = math.floor(vectors_to_upsert / batch_size) + for _ in range(num_batches): + vector = random_embedding_values(dimension) + vecs = [{'id': random_string(10), 'values': vector} for i in range(batch_size)] + idx.upsert(vectors=vecs) + print(f'Done upserting.') + + assert stats.dimension == int(read_env_var('DIMENSION')) + assert stats.metric == read_env_var('METRIC') + assert stats.total_vector_count == vectors_to_upsert + +if __name__ == '__main__': + main() + From a30d33b339f3b91c86e474283cd3b73f36c31e2a Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Sun, 14 Jan 2024 03:14:25 -0500 Subject: [PATCH 40/42] Adjust script --- scripts/3.x/test-collection.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/3.x/test-collection.py b/scripts/3.x/test-collection.py index e9fc01dbf..0f4f6d9d6 100644 --- a/scripts/3.x/test-collection.py +++ b/scripts/3.x/test-collection.py @@ -26,7 +26,8 @@ def main(): print(f'Collection description: {description}') assert description.name == collection_name - assert description['status'] == 'Ready' + assert description.status.state == 'Ready' + assert description.status.ready == True From ad8e51e212e5b5a0b4d57ae40089e1aa6af3610b Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Sun, 14 Jan 2024 03:42:21 -0500 Subject: [PATCH 41/42] Adjust test-collection --- scripts/3.x/test-collection.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/3.x/test-collection.py b/scripts/3.x/test-collection.py index 0f4f6d9d6..bfc2da119 100644 --- a/scripts/3.x/test-collection.py +++ b/scripts/3.x/test-collection.py @@ -25,9 +25,9 @@ def main(): description = pc.describe_collection(collection_name) print(f'Collection description: {description}') - assert description.name == collection_name - assert description.status.state == 'Ready' - assert description.status.ready == True + assert description['name'] == collection_name + assert description['status']['state'] == 'Ready' + assert description['status']['ready'] == True From a2caa3d1cfd28f505d2dc2b5a47cf06993996b32 Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Sun, 14 Jan 2024 04:15:01 -0500 Subject: [PATCH 42/42] Disable collection cleanup --- .github/workflows/pr.yaml | 24 ++++++++++++------------ .github/workflows/testing-migration.yaml | 24 ++++++++++++------------ 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index a300c1c65..828f12542 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -50,18 +50,18 @@ jobs: PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} pinecone_client_version: 3.0.0.dev10 - cleanup-collections: - if: always() - needs: [migration-tests] - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Delete all collections - uses: ./.github/actions/delete-all-collections - with: - PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} - pinecone_client_version: 3.0.0.dev10 + # cleanup-collections: + # if: always() + # needs: [migration-tests] + # runs-on: ubuntu-latest + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + # - name: Delete all collections + # uses: ./.github/actions/delete-all-collections + # with: + # PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} + # pinecone_client_version: 3.0.0.dev10 # unit-tests: # uses: './.github/workflows/testing-unit.yaml' diff --git a/.github/workflows/testing-migration.yaml b/.github/workflows/testing-migration.yaml index d00b8c440..af922db4e 100644 --- a/.github/workflows/testing-migration.yaml +++ b/.github/workflows/testing-migration.yaml @@ -130,15 +130,15 @@ jobs: PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} index_name: ${{ needs.create-index-from-collection-new.outputs.index_name }} - cleanup-collection: - if: always() - needs: [test-collection-new, create-collection, create-index-from-collection-new] - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Delete collection - uses: ./.github/actions/delete-collection - with: - PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} - collection_name: ${{ needs.create-collection.outputs.collection_name }} + # cleanup-collection: + # if: always() + # needs: [test-collection-new, create-collection, create-index-from-collection-new] + # runs-on: ubuntu-latest + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + # - name: Delete collection + # uses: ./.github/actions/delete-collection + # with: + # PINECONE_API_KEY: ${{ secrets.V3MIGRATION_API_KEY__ONE_KEY_MANY_ENVS }} + # collection_name: ${{ needs.create-collection.outputs.collection_name }}