Skip to content

Commit

Permalink
Attempt to make CI run Pinecone tests more reliably
Browse files Browse the repository at this point in the history
  • Loading branch information
jmartisk committed Dec 5, 2023
1 parent 51fc36e commit 00c8bb3
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 14 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/build-nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build nightly

on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:

defaults:
run:
shell: bash

jobs:
build:
name: Build on ${{ matrix.os }} - ${{ matrix.java }}
strategy:
# PineconeEmbeddingStoreTest uses a single shared index, we can't run multiple CI runs on it at once
max-parallel: 1
fail-fast: false
matrix:
os: [ubuntu-latest]
java: [17, 21]
runs-on: ${{ matrix.os }}
steps:
- name: Prepare git
run: git config --global core.autocrlf false
if: startsWith(matrix.os, 'windows')

- uses: actions/checkout@v3
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: ${{ matrix.java }}
cache: 'maven'

- name: Build with Maven
run: mvn -B clean install -Dno-format
env:
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
PINECONE_ENVIRONMENT: ${{ secrets.PINECONE_ENVIRONMENT }}
PINECONE_INDEX_NAME: ${{ secrets.PINECONE_INDEX_NAME }}
PINECONE_PROJECT_ID: ${{ secrets.PINECONE_PROJECT_ID }}

- name: Build with Maven (Native)
run: mvn -B install -Dnative -Dquarkus.native.container-build -Dnative.surefire.skip
env:
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
PINECONE_ENVIRONMENT: ${{ secrets.PINECONE_ENVIRONMENT }}
PINECONE_INDEX_NAME: ${{ secrets.PINECONE_INDEX_NAME }}
PINECONE_PROJECT_ID: ${{ secrets.PINECONE_PROJECT_ID }}
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
name: Build
name: Build (on pull request)

on:
push:
branches:
- "main"
paths-ignore:
- '.gitignore'
- 'CODEOWNERS'
- 'LICENSE'
- '*.md'
- '*.adoc'
- '*.txt'
- '.all-contributorsrc'
pull_request:
paths-ignore:
- '.gitignore'
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/build-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build (on push)

on:
push:
branches:
- "main"
paths-ignore:
- '.gitignore'
- 'CODEOWNERS'
- 'LICENSE'
- '*.md'
- '*.adoc'
- '*.txt'
- '.all-contributorsrc'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

defaults:
run:
shell: bash

jobs:
build:
name: Build on ${{ matrix.os }} - ${{ matrix.java }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
java: [17, 21]
runs-on: ${{ matrix.os }}
steps:
- name: Prepare git
run: git config --global core.autocrlf false
if: startsWith(matrix.os, 'windows')

- uses: actions/checkout@v3
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: ${{ matrix.java }}
cache: 'maven'

- name: Build with Maven
run: mvn -B clean install -Dno-format

- name: Build with Maven (Native)
run: mvn -B install -Dnative -Dquarkus.native.container-build -Dnative.surefire.skip
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,13 @@ public void cleanup() {
// Normally we would use deleteAll=true for deleting all vectors,
// but that doesn't work in the gcp-starter environment,
// so make it a two-step process instead by querying for all vectors, and then removing them.
Log.info("About to delete all embeddings");
PineconeVectorOperationsApi client = embeddingStore.getUnderlyingClient();
float[] vector = new float[384];
QueryRequest allRequest = new QueryRequest(null, 10000L, false, false, vector);
List<String> existingEntries = client.query(allRequest).getMatches().stream().map(VectorMatch::getId).toList();
if (!existingEntries.isEmpty()) {
Log.info("Deleting " + existingEntries.size() + " embeddings");
Log.info("Deleting " + existingEntries.size() + " embeddings: " + existingEntries);
client.delete(new DeleteRequest(existingEntries, false, null, null));
}

Expand All @@ -97,7 +98,9 @@ public void cleanup() {
*/
private static void delay() {
try {
TimeUnit.SECONDS.sleep(30);
int timeout = 40;
Log.info("Waiting " + timeout + " seconds to allow Pinecone time to process deletions");
TimeUnit.SECONDS.sleep(timeout);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
Expand Down

0 comments on commit 00c8bb3

Please sign in to comment.