Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3,421 changes: 3,421 additions & 0 deletions .durations_grpc

Large diffs are not rendered by default.

167 changes: 167 additions & 0 deletions .durations_rest_asyncio

Large diffs are not rendered by default.

301 changes: 301 additions & 0 deletions .durations_rest_sync

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion .github/actions/index-create/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@ inputs:
dimension:
description: 'The dimension of the index'
required: false
default: '3'
default: ''
metric:
description: 'The metric of the index'
required: false
default: 'cosine'
vector_type:
description: 'The type of the index'
required: false
default: 'dense'
PINECONE_API_KEY:
description: 'The Pinecone API key'
required: true
Expand All @@ -36,6 +40,10 @@ outputs:
description: 'The name of the index, including randomized suffix'
value: ${{ steps.create-index.outputs.index_name }}

index_host:
description: 'The host of the index'
value: ${{ steps.create-index.outputs.index_host }}

runs:
using: 'composite'
steps:
Expand All @@ -52,5 +60,6 @@ runs:
NAME_PREFIX: ${{ inputs.name_prefix }}
REGION: ${{ inputs.region }}
CLOUD: ${{ inputs.cloud }}
VECTOR_TYPE: ${{ inputs.vector_type }}
DIMENSION: ${{ inputs.dimension }}
METRIC: ${{ inputs.metric }}
70 changes: 30 additions & 40 deletions .github/actions/index-create/create.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import os
import re
import random
import string
from datetime import datetime
import uuid
from pinecone import Pinecone
from datetime import datetime


def read_env_var(name):
Expand All @@ -22,39 +22,9 @@ def write_gh_output(name, value):
print(f"{name}={value}", file=fh)


def generate_index_name(test_name: str) -> str:
github_actor = os.getenv("GITHUB_ACTOR", None)
user = os.getenv("USER", None)
index_owner = github_actor or user

formatted_date = datetime.now().strftime("%Y%m%d-%H%M%S%f")[:-3]

github_job = os.getenv("GITHUB_JOB", None)

if test_name.startswith("test_"):
test_name = test_name[5:]

# Remove trailing underscore, if any
if test_name.endswith("_"):
test_name = test_name[:-1]

name_parts = [index_owner, formatted_date, github_job, test_name]
index_name = "-".join([x for x in name_parts if x is not None])

# Remove invalid characters
replace_with_hyphen = re.compile(r"[\[\(_,\s]")
index_name = re.sub(replace_with_hyphen, "-", index_name)
replace_with_empty = re.compile(r"[\]\)\.]")
index_name = re.sub(replace_with_empty, "", index_name)

max_length = 45
index_name = index_name[:max_length]

# Trim final character if it is not alphanumeric
if index_name.endswith("_") or index_name.endswith("-"):
index_name = index_name[:-1]

return index_name.lower()
def generate_index_name(name_prefix: str) -> str:
name = name_prefix.lower() + "-" + str(uuid.uuid4())
return name[:45]


def get_tags():
Expand All @@ -74,15 +44,35 @@ def get_tags():

def main():
pc = Pinecone(api_key=read_env_var("PINECONE_API_KEY"))
index_name = generate_index_name(read_env_var("NAME_PREFIX") + random_string(20))
index_name = generate_index_name(read_env_var("NAME_PREFIX"))
dimension_var = read_env_var("DIMENSION")
if dimension_var is not None and dimension_var != "":
dimension = int(dimension_var)
else:
dimension = None

vector_type_var = read_env_var("VECTOR_TYPE")
if vector_type_var is not None and vector_type_var != "":
vector_type = vector_type_var
else:
vector_type = None

metric = read_env_var("METRIC")
cloud = read_env_var("CLOUD")
region = read_env_var("REGION")
tags = get_tags()

pc.create_index(
name=index_name,
metric=read_env_var("METRIC"),
dimension=int(read_env_var("DIMENSION")),
spec={"serverless": {"cloud": read_env_var("CLOUD"), "region": read_env_var("REGION")}},
tags=get_tags(),
metric=metric,
dimension=dimension,
vector_type=vector_type,
tags=tags,
spec={"serverless": {"cloud": cloud, "region": region}},
)
description = pc.describe_index(name=index_name)
write_gh_output("index_name", index_name)
write_gh_output("index_host", description.host)


if __name__ == "__main__":
Expand Down
24 changes: 22 additions & 2 deletions .github/actions/run-integration-test/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@ inputs:
description: 'Whether to use gRPC or REST'
required: false
default: 'false'
PINECONE_CLIENT_ID:
description: 'The client ID to use for admin tests'
required: false
PINECONE_CLIENT_SECRET:
description: 'The client secret to use for admin tests'
required: false
INDEX_HOST_DENSE:
description: 'The host of the dense index for db data tests'
required: false
INDEX_HOST_SPARSE:
description: 'The host of the sparse index for db data tests'
required: false

runs:
using: 'composite'
Expand All @@ -33,9 +45,17 @@ runs:
- name: Run tests
id: run-tests
shell: bash
run: poetry run pytest tests/integration/${{ inputs.test_suite }} --retries 2 --retry-delay 35 -s -vv --log-cli-level=DEBUG --durations=20
run: |
poetry run pytest ${{ inputs.test_suite }} \
--retries 2 \
--retry-delay 35 \
--log-cli-level=DEBUG \
-s -vv
env:
PINECONE_API_KEY: ${{ steps.decrypt-api-key.outputs.decrypted_secret }}
PINECONE_ADDITIONAL_HEADERS: ${{ inputs.PINECONE_ADDITIONAL_HEADERS }}
PINECONE_CLIENT_ID: ${{ inputs.PINECONE_CLIENT_ID }}
PINECONE_CLIENT_SECRET: ${{ inputs.PINECONE_CLIENT_SECRET }}
USE_GRPC: ${{ inputs.use_grpc }}
SKIP_WEIRD: 'true'
INDEX_HOST_DENSE: ${{ inputs.INDEX_HOST_DENSE }}
INDEX_HOST_SPARSE: ${{ inputs.INDEX_HOST_SPARSE }}
Loading
Loading