Skip to content

Commit e087278

Browse files
committed
WIP on grpc asyncio and query_namespaces method
This commit squashes several previous commits on this branch to address a GitGuardian security check that continues to fail because an early commit contained a leaked development key.
1 parent ddef712 commit e087278

28 files changed

+2148
-247
lines changed

.github/actions/create-index/action.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@ outputs:
3030
index_name:
3131
description: 'The name of the index, including randomized suffix'
3232
value: ${{ steps.create-index.outputs.index_name }}
33+
index_host:
34+
description: 'The host of the index'
35+
value: ${{ steps.create-index.outputs.index_host }}
36+
index_dimension:
37+
description: 'The dimension of the index'
38+
value: ${{ steps.create-index.outputs.index_dimension }}
39+
index_metric:
40+
description: 'The metric of the index'
41+
value: ${{ steps.create-index.outputs.index_metric }}
3342

3443
runs:
3544
using: 'composite'
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: 'Test Data Plane'
2+
description: 'Runs tests on the Pinecone data plane'
3+
4+
inputs:
5+
metric:
6+
description: 'The metric of the index'
7+
required: true
8+
dimension:
9+
description: 'The dimension of the index'
10+
required: true
11+
host:
12+
description: 'The host of the index'
13+
required: true
14+
use_grpc:
15+
description: 'Whether to use gRPC or REST'
16+
required: true
17+
freshness_timeout_seconds:
18+
description: 'The number of seconds to wait for the index to become fresh'
19+
required: false
20+
default: '60'
21+
PINECONE_API_KEY:
22+
description: 'The Pinecone API key'
23+
required: true
24+
25+
outputs:
26+
index_name:
27+
description: 'The name of the index, including randomized suffix'
28+
value: ${{ steps.create-index.outputs.index_name }}
29+
30+
runs:
31+
using: 'composite'
32+
steps:
33+
- name: Set up Python
34+
uses: actions/setup-python@v5
35+
with:
36+
python-version: ${{ inputs.python_version }}
37+
38+
- name: Setup Poetry
39+
uses: ./.github/actions/setup-poetry
40+
with:
41+
include_grpc: ${{ inputs.use_grpc }}
42+
include_dev: 'true'
43+
44+
- name: Run data plane tests
45+
id: data-plane-tests
46+
shell: bash
47+
run: poetry run pytest tests/integration/data_asyncio
48+
env:
49+
PINECONE_API_KEY: ${{ inputs.PINECONE_API_KEY }}
50+
USE_GRPC: ${{ inputs.use_grpc }}
51+
METRIC: ${{ inputs.metric }}
52+
INDEX_HOST: ${{ inputs.host }}
53+
DIMENSION: ${{ inputs.dimension }}
54+
SPEC: ${{ inputs.spec }}
55+
FRESHNESS_TIMEOUT_SECONDS: ${{ inputs.freshness_timeout_seconds }}

.github/workflows/alpha-release.yaml

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,22 @@ on:
2424
default: 'rc1'
2525

2626
jobs:
27-
unit-tests:
28-
uses: './.github/workflows/testing-unit.yaml'
29-
secrets: inherit
30-
integration-tests:
31-
uses: './.github/workflows/testing-integration.yaml'
32-
secrets: inherit
33-
dependency-tests:
34-
uses: './.github/workflows/testing-dependency.yaml'
35-
secrets: inherit
27+
# unit-tests:
28+
# uses: './.github/workflows/testing-unit.yaml'
29+
# secrets: inherit
30+
# integration-tests:
31+
# uses: './.github/workflows/testing-integration.yaml'
32+
# secrets: inherit
33+
# dependency-tests:
34+
# uses: './.github/workflows/testing-dependency.yaml'
35+
# secrets: inherit
3636

3737
pypi:
3838
uses: './.github/workflows/publish-to-pypi.yaml'
39-
needs:
40-
- unit-tests
41-
- integration-tests
42-
- dependency-tests
39+
# needs:
40+
# - unit-tests
41+
# - integration-tests
42+
# - dependency-tests
4343
with:
4444
isPrerelease: true
4545
ref: ${{ inputs.ref }}
@@ -49,4 +49,3 @@ jobs:
4949
secrets:
5050
PYPI_USERNAME: __token__
5151
PYPI_PASSWORD: ${{ secrets.PROD_PYPI_PUBLISH_TOKEN }}
52-

.github/workflows/testing-integration.yaml

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,64 @@ jobs:
2525
PINECONE_DEBUG_CURL: 'true'
2626
PINECONE_API_KEY: '${{ secrets.PINECONE_API_KEY }}'
2727

28+
data-plane-setup:
29+
name: Create index
30+
runs-on: ubuntu-latest
31+
outputs:
32+
index_name: ${{ steps.setup-index.outputs.index_name }}
33+
index_host: ${{ steps.setup-index.outputs.index_host }}
34+
index_dimension: ${{ steps.setup-index.outputs.index_dimension }}
35+
index_metric: ${{ steps.setup-index.outputs.index_metric }}
36+
steps:
37+
- uses: actions/checkout@v4
38+
- name: Create index
39+
id: setup-index
40+
uses: ./.github/actions/create-index
41+
timeout-minutes: 5
42+
with:
43+
dimension: 100
44+
metric: 'cosine'
45+
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
46+
47+
48+
test-data-plane-asyncio:
49+
name: Data plane asyncio integration tests
50+
runs-on: ubuntu-latest
51+
needs:
52+
- data-plane-setup
53+
outputs:
54+
index_name: ${{ needs.data-plane-setup.outputs.index_name }}
55+
strategy:
56+
fail-fast: false
57+
matrix:
58+
python_version: [3.8, 3.12]
59+
use_grpc: [true]
60+
spec:
61+
- '{ "asyncio": { "environment": "us-east1-gcp" }}'
62+
steps:
63+
- uses: actions/checkout@v4
64+
- uses: ./.github/actions/test-data-plane-asyncio
65+
with:
66+
python_version: '${{ matrix.python_version }}'
67+
use_grpc: '${{ matrix.use_grpc }}'
68+
metric: '${{ needs.data-plane-setup.outputs.index_metric }}'
69+
dimension: '${{ needs.data-plane-setup.outputs.index_dimension }}'
70+
host: '${{ needs.data-plane-setup.outputs.index_host }}'
71+
PINECONE_API_KEY: '${{ secrets.PINECONE_API_KEY }}'
72+
freshness_timeout_seconds: 600
73+
74+
data-plane-asyncio-cleanup:
75+
name: Deps cleanup
76+
runs-on: ubuntu-latest
77+
needs:
78+
- test-data-plane-asyncio
79+
steps:
80+
- uses: actions/checkout@v4
81+
- uses: ./.github/actions/delete-index
82+
with:
83+
index_name: '${{ needs.test-data-plane-asyncio.outputs.index_name }}'
84+
PINECONE_API_KEY: '${{ secrets.PINECONE_API_KEY }}'
85+
2886
data-plane-serverless:
2987
name: Data plane serverless integration tests
3088
runs-on: ubuntu-latest
@@ -33,7 +91,7 @@ jobs:
3391
matrix:
3492
python_version: [3.8, 3.12]
3593
use_grpc: [true, false]
36-
metric:
94+
metric:
3795
- cosine
3896
# - euclidean
3997
# - dotproduct

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ venv.bak/
137137
.ropeproject
138138

139139
# pdocs documentation
140-
# We want to exclude any locally generated artifacts, but we rely on
140+
# We want to exclude any locally generated artifacts, but we rely on
141141
# keeping documentation assets in the docs/ folder.
142142
docs/*
143143
!docs/pinecone-python-client-fork.png
@@ -155,4 +155,6 @@ dmypy.json
155155
*.hdf5
156156
*~
157157

158-
tests/integration/proxy_config/logs
158+
tests/integration/proxy_config/logs
159+
*.parquet
160+
app*.py

app.py

Lines changed: 0 additions & 31 deletions
This file was deleted.

app2.py

Lines changed: 0 additions & 16 deletions
This file was deleted.

app3.py

Lines changed: 0 additions & 62 deletions
This file was deleted.

pinecone/control/pinecone.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import time
22
import logging
3-
from typing import Optional, Dict, Any, Union, List, Tuple, Literal
3+
from typing import Optional, Dict, Any, Union, Literal
44

55
from .index_host_store import IndexHostStore
66

@@ -10,7 +10,12 @@
1010
from pinecone.core.openapi.shared.api_client import ApiClient
1111

1212

13-
from pinecone.utils import normalize_host, setup_openapi_client, build_plugin_setup_client
13+
from pinecone.utils import (
14+
normalize_host,
15+
setup_openapi_client,
16+
build_plugin_setup_client,
17+
parse_non_empty_args,
18+
)
1419
from pinecone.core.openapi.control.models import (
1520
CreateCollectionRequest,
1621
CreateIndexRequest,
@@ -317,9 +322,6 @@ def create_index(
317322

318323
api_instance = self.index_api
319324

320-
def _parse_non_empty_args(args: List[Tuple[str, Any]]) -> Dict[str, Any]:
321-
return {arg_name: val for arg_name, val in args if val is not None}
322-
323325
if deletion_protection in ["enabled", "disabled"]:
324326
dp = DeletionProtection(deletion_protection)
325327
else:
@@ -329,7 +331,7 @@ def _parse_non_empty_args(args: List[Tuple[str, Any]]) -> Dict[str, Any]:
329331
if "serverless" in spec:
330332
index_spec = IndexSpec(serverless=ServerlessSpecModel(**spec["serverless"]))
331333
elif "pod" in spec:
332-
args_dict = _parse_non_empty_args(
334+
args_dict = parse_non_empty_args(
333335
[
334336
("environment", spec["pod"].get("environment")),
335337
("metadata_config", spec["pod"].get("metadata_config")),
@@ -351,7 +353,7 @@ def _parse_non_empty_args(args: List[Tuple[str, Any]]) -> Dict[str, Any]:
351353
serverless=ServerlessSpecModel(cloud=spec.cloud, region=spec.region)
352354
)
353355
elif isinstance(spec, PodSpec):
354-
args_dict = _parse_non_empty_args(
356+
args_dict = parse_non_empty_args(
355357
[
356358
("replicas", spec.replicas),
357359
("shards", spec.shards),

pinecone/exceptions/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
)
1313
from .exceptions import PineconeConfigurationError, PineconeProtocolError, ListConversionException
1414

15+
PineconeNotFoundException = NotFoundException
16+
1517
__all__ = [
1618
"PineconeConfigurationError",
1719
"PineconeProtocolError",
@@ -22,6 +24,7 @@
2224
"PineconeApiKeyError",
2325
"PineconeApiException",
2426
"NotFoundException",
27+
"PineconeNotFoundException",
2528
"UnauthorizedException",
2629
"ForbiddenException",
2730
"ServiceException",

0 commit comments

Comments
 (0)