Skip to content

Commit

Permalink
Update ci.yml
Browse files Browse the repository at this point in the history
Signed-off-by: Vijayan Balasubramanian <[email protected]>
  • Loading branch information
VijayanB committed Dec 2, 2024
1 parent 07fbc88 commit 9d1affe
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 12 deletions.
16 changes: 9 additions & 7 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ on:
- 'jni/**'
- 'micro-benchmarks/**'
- '.github/workflows/CI.yml'
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true


jobs:
Get-CI-Image-Tag:
Expand All @@ -52,11 +51,13 @@ jobs:
# this image tag is subject to change as more dependencies and updates will arrive over time
image: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-version-linux }}
# need to switch to root so that github actions can install runner binary on container without permission issues.
options: --user root
options: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-options }}

steps:
- name: Run start commands
run: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-command }}
- name: Checkout k-NN
uses: actions/checkout@v1
uses: actions/checkout@v4

# Setup git user so that patches for native libraries can be applied and committed
- name: Setup git user
Expand All @@ -65,8 +66,9 @@ jobs:
su `id -un 1000` -c 'git config --global user.email "github-actions[bot]@users.noreply.github.com"'
- name: Setup Java ${{ matrix.java }}
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
distribution: "corretto"
java-version: ${{ matrix.java }}

- name: Run build
Expand All @@ -84,7 +86,7 @@ jobs:
- name: Upload Coverage Report
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}

Expand All @@ -99,7 +101,7 @@ jobs:

steps:
- name: Checkout k-NN
uses: actions/checkout@v1
uses: actions/checkout@v4

# Setup git user so that patches for native libraries can be applied and committed
- name: Setup git user
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/test_security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ on:
- 'gradle/**'
- 'jni/**'
- '.github/workflows/test_security.yml'
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true

jobs:
Get-CI-Image-Tag:
Expand All @@ -50,21 +48,24 @@ jobs:
# this image tag is subject to change as more dependencies and updates will arrive over time
image: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-version-linux }}
# need to switch to root so that github actions can install runner binary on container without permission issues.
options: --user root
options: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-options }}

steps:
- name: Run start commands
run: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-command }}
- name: Checkout k-NN
uses: actions/checkout@v1
uses: actions/checkout@v4
# Setup git user so that patches for native libraries can be applied and committed
- name: Setup git user
run: |
su `id -un 1000` -c 'git config --global user.name "github-actions[bot]"'
su `id -un 1000` -c 'git config --global user.email "github-actions[bot]@users.noreply.github.com"'
- name: Setup Java ${{ matrix.java }}
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: "corretto"

- name: Run build
# switching the user, as OpenSearch cluster can only be started as root/Administrator on linux-deb/linux-rpm/windows-zip.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.opensearch.knn.KNNResult;
import org.opensearch.knn.index.SpaceType;
import org.opensearch.core.rest.RestStatus;
import org.opensearch.knn.index.engine.KNNEngine;

import java.util.Collections;
import java.util.HashMap;
Expand Down Expand Up @@ -122,4 +123,24 @@ private void validateKNNInnerProductScriptScoreSearch(String testIndex, String t
}
}

// KNN script scoring for space_type "l2"
public void testNonKNNIndex_withModelIdParams() throws Exception {
if (isRunningAgainstOldCluster()) {
createKnnIndex(
testIndex,
createKNNDefaultScriptScoreSettings(),
createKnnIndexMapping(TEST_FIELD, DIMENSIONS, "hnsw", KNNEngine.FAISS.getName(), SpaceType.DEFAULT.getValue(), false)
);
addKNNDocs(testIndex, TEST_FIELD, DIMENSIONS, DOC_ID, NUM_DOCS);
} else {
QUERY_COUNT = NUM_DOCS;
DOC_ID = NUM_DOCS;
validateKNNScriptScoreSearch(testIndex, TEST_FIELD, DIMENSIONS, QUERY_COUNT, K, SpaceType.L2);
addKNNDocs(testIndex, TEST_FIELD, DIMENSIONS, DOC_ID, NUM_DOCS);
QUERY_COUNT = QUERY_COUNT + NUM_DOCS;
validateKNNScriptScoreSearch(testIndex, TEST_FIELD, DIMENSIONS, QUERY_COUNT, K, SpaceType.L2);
deleteKNNIndex(testIndex);
}
}

}

0 comments on commit 9d1affe

Please sign in to comment.