Skip to content
Merged
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
8 changes: 7 additions & 1 deletion .github/actions/setup-poetry/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ inputs:
description: 'Install typing dependencies (mypy, type stubs, etc)'
required: true
default: 'true'
include_asyncio:
description: 'Install asyncio dependencies'
required: true
default: 'false'

runs:
using: 'composite'
Expand All @@ -26,8 +30,10 @@ runs:
INCLUDE_GRPC: ${{ inputs.include_grpc }}
INCLUDE_DEV: ${{ inputs.include_dev }}
INCLUDE_TYPES: ${{ inputs.include_types }}
INCLUDE_ASYNCIO: ${{ inputs.include_asyncio }}
run: |
GRPC_FLAG=$( [ "$INCLUDE_GRPC" = "true" ] && echo "--extras grpc" || echo "" )
ASYNCIO_FLAG=$( [ "$INCLUDE_ASYNCIO" = "true" ] && echo "--extras asyncio" || echo "" )
DEV_FLAG=$( [ "$INCLUDE_DEV" = "false" ] && echo "--without dev" || echo "" )
TYPING_FLAG=$( [ "$INCLUDE_TYPES" = "true" ] && echo "--with types" || echo "" )
poetry install $DEV_FLAG $TYPING_FLAG $GRPC_FLAG
poetry install $DEV_FLAG $TYPING_FLAG $GRPC_FLAG $ASYNCIO_FLAG
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ runs:
with:
include_grpc: ${{ inputs.use_grpc }}
include_dev: 'true'
include_asyncio: 'true'

- name: Run data plane tests
id: data-plane-asyncio-tests
Expand Down
1 change: 1 addition & 0 deletions .github/actions/test-dependency-asyncio-rest/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ runs:
with:
include_grpc: false
include_types: false
include_asyncio: true

- name: 'Install aiohttp ${{ matrix.aiohttp-version }}'
run: 'poetry add aiohttp==${{ matrix.aiohttp-version }}'
Expand Down
56 changes: 56 additions & 0 deletions .github/workflows/testing-integration-asyncio.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: "DB Integration: Asyncio"
'on':
workflow_call: {}

jobs:
db-data-asyncio:
name: db_data asyncio
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python_version:
- 3.9
- 3.13
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
- name: Setup Poetry
uses: ./.github/actions/setup-poetry
with:
include_dev: true
include_asyncio: true
- name: Run data plane tests
id: data-plane-asyncio-tests
shell: bash
run: poetry run pytest tests/integration/data_asyncio -s -vv
env:
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}

db-control-asyncio:
name: db_control asyncio
runs-on: ubuntu-latest
strategy:
matrix:
python_version:
- 3.9
- 3.12
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: 'Set up Python ${{ matrix.python_version }}'
uses: actions/setup-python@v5
with:
python-version: '${{ matrix.python_version }}'
- name: Setup Poetry
uses: ./.github/actions/setup-poetry
with:
include_asyncio: true
include_dev: true
- name: 'db_control asyncio'
run: poetry run pytest tests/integration/control_asyncio -s -vv
env:
PINECONE_API_KEY: '${{ secrets.PINECONE_API_KEY }}'
157 changes: 60 additions & 97 deletions .github/workflows/testing-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,37 @@ name: "Integration Tests"
workflow_call: {}

jobs:
db-data-serverless:
name: db_data rest

inference:
name: Inference tests
runs-on: ubuntu-latest
needs:
- inference
strategy:
fail-fast: false
matrix:
python_version:
- 3.9
- 3.13
use_grpc: [true, false]
python_version: [3.9, 3.12]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/test-data-plane
- name: 'Set up Python ${{ matrix.python_version }}'
uses: actions/setup-python@v5
with:
python_version: '${{ matrix.python_version }}'
use_grpc: '${{ matrix.use_grpc }}'
metric: 'cosine'
spec: '{ "serverless": { "region": "us-west-2", "cloud": "aws" }}'
python-version: '${{ matrix.python_version }}'
- name: Setup Poetry
uses: ./.github/actions/setup-poetry
with:
include_asyncio: true
- name: 'Run integration tests'
run: poetry run pytest tests/integration/inference -s -vv
env:
PINECONE_DEBUG_CURL: 'true'
PINECONE_API_KEY: '${{ secrets.PINECONE_API_KEY }}'
freshness_timeout_seconds: 600
skip_weird_id_tests: 'true'

db-data-asyncio:
name: db_data asyncio

dependency-test-asyncio:
uses: './.github/workflows/testing-integration-asyncio.yaml'
secrets: inherit
needs: inference

db-data-serverless:
name: db_data rest
runs-on: ubuntu-latest
needs:
- inference
Expand All @@ -38,48 +43,51 @@ jobs:
python_version:
- 3.9
- 3.13
use_grpc: [false, true]
use_grpc: [true, false]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/test-asyncio
- uses: ./.github/actions/test-data-plane
with:
python_version: '${{ matrix.python_version }}'
use_grpc: '${{ matrix.use_grpc }}'
metric: 'cosine'
spec: '{ "serverless": { "region": "us-west-2", "cloud": "aws" }}'
PINECONE_API_KEY: '${{ secrets.PINECONE_API_KEY }}'
freshness_timeout_seconds: 600
skip_weird_id_tests: 'true'


db-control-rest-pod:
name: db_control pod/collection tests
runs-on: ubuntu-latest
needs:
- inference
strategy:
matrix:
testConfig:
- python-version: 3.9
pod: { environment: 'us-east1-gcp'}
- python-version: 3.13
pod: { environment: 'us-east1-gcp'}
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: 'Set up Python ${{ matrix.testConfig.python-version }}'
uses: actions/setup-python@v5
with:
python-version: '${{ matrix.testConfig.python-version }}'
- name: Setup Poetry
uses: ./.github/actions/setup-poetry
- name: 'Run integration tests (REST, prod)'
run: poetry run pytest tests/integration/control/pod -s -v
env:
PINECONE_DEBUG_CURL: 'true'
PINECONE_API_KEY: '${{ secrets.PINECONE_API_KEY }}'
PINECONE_ENVIRONMENT: '${{ matrix.testConfig.pod.environment }}'
GITHUB_BUILD_NUMBER: '${{ github.run_number }}-s-${{ matrix.testConfig.python-version}}'
DIMENSION: 10
METRIC: 'cosine'
# db-control-rest-pod:
# name: db_control pod/collection tests
# runs-on: ubuntu-latest
# needs:
# - inference
# strategy:
# matrix:
# testConfig:
# - python-version: 3.9
# pod: { environment: 'us-east1-gcp'}
# - python-version: 3.13
# pod: { environment: 'us-east1-gcp'}
# fail-fast: false
# steps:
# - uses: actions/checkout@v4
# - name: 'Set up Python ${{ matrix.testConfig.python-version }}'
# uses: actions/setup-python@v5
# with:
# python-version: '${{ matrix.testConfig.python-version }}'
# - name: Setup Poetry
# uses: ./.github/actions/setup-poetry
# with:
# include_asyncio: true
# - name: 'Run integration tests (REST)'
# run: poetry run pytest tests/integration/control/pod -s -v
# env:
# PINECONE_DEBUG_CURL: 'true'
# PINECONE_API_KEY: '${{ secrets.PINECONE_API_KEY }}'
# PINECONE_ENVIRONMENT: '${{ matrix.testConfig.pod.environment }}'
# GITHUB_BUILD_NUMBER: '${{ github.run_number }}-s-${{ matrix.testConfig.python-version}}'
# DIMENSION: 10
# METRIC: 'cosine'

db-control-rest-serverless:
name: db_control serverless
Expand All @@ -104,55 +112,10 @@ jobs:
python-version: '${{ matrix.testConfig.python-version }}'
- name: Setup Poetry
uses: ./.github/actions/setup-poetry
- name: 'Run integration tests (REST, prod)'
- name: 'Run integration tests (REST)'
run: poetry run pytest tests/integration/control/serverless -s -vv
env:
PINECONE_DEBUG_CURL: 'true'
PINECONE_API_KEY: '${{ secrets.PINECONE_API_KEY }}'
SERVERLESS_CLOUD: '${{ matrix.testConfig.serverless.cloud }}'
SERVERLESS_REGION: '${{ matrix.testConfig.serverless.region }}'

db-control-asyncio:
name: db_control asyncio
runs-on: ubuntu-latest
needs:
- inference
strategy:
matrix:
python_version:
- 3.9
- 3.12
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: 'Set up Python ${{ matrix.python_version }}'
uses: actions/setup-python@v5
with:
python-version: '${{ matrix.python_version }}'
- name: Setup Poetry
uses: ./.github/actions/setup-poetry
- name: 'Run integration tests (asyncio, prod)'
run: poetry run pytest tests/integration/control_asyncio -s -vv
env:
PINECONE_DEBUG_CURL: 'true'
PINECONE_API_KEY: '${{ secrets.PINECONE_API_KEY }}'

inference:
name: Inference tests
runs-on: ubuntu-latest
strategy:
matrix:
python_version: [3.9, 3.12]
steps:
- uses: actions/checkout@v4
- name: 'Set up Python ${{ matrix.python_version }}'
uses: actions/setup-python@v5
with:
python-version: '${{ matrix.python_version }}'
- name: Setup Poetry
uses: ./.github/actions/setup-poetry
- name: 'Run integration tests'
run: poetry run pytest tests/integration/inference -s -vv
env:
PINECONE_DEBUG_CURL: 'true'
PINECONE_API_KEY: '${{ secrets.PINECONE_API_KEY }}'
2 changes: 2 additions & 0 deletions .github/workflows/testing-unit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
with:
include_grpc: '${{ matrix.use_grpc }}'
include_types: true
include_asyncio: true

- name: mypy check
run: poetry run mypy pinecone
Expand Down Expand Up @@ -54,6 +55,7 @@ jobs:
with:
include_grpc: '${{ matrix.use_grpc }}'
include_types: false
include_asyncio: true

- name: Run unit tests (REST)
run: poetry run pytest --cov=pinecone --timeout=120 tests/unit
Expand Down
13 changes: 7 additions & 6 deletions pinecone/openapi_support/rest_aiohttp.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@


class AiohttpRestClient(RestClientInterface):
def __init__(self, configuration, pools_size=4, maxsize=None) -> None:
import aiohttp
def __init__(self, configuration) -> None:
try:
import aiohttp
except ImportError:
raise ImportError(
"Additional dependencies are required to use Pinecone with asyncio. Include these extra dependencies in your project by installing `pinecone[asyncio]`."
) from None

conn = aiohttp.TCPConnector()
self._session = aiohttp.ClientSession(connector=conn)

# async def _cleanup(self):
# if not self._session.closed:
# await self._session.close()

async def close(self):
await self._session.close()

Expand Down
Loading
Loading