Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

windows CI for AD #703

Merged
merged 4 commits into from
Oct 28, 2022
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
24 changes: 24 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,30 @@ on:
- "*"

jobs:
Build-ad-windows:
strategy:
matrix:
java: [ 11, 17 ]
name: Build and Test Anomaly Detection Plugin on Windows
runs-on: windows-latest
steps:
- name: Setup Java ${{ matrix.java }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
# checkout Anomaly Detection
- name: Checkout Anomaly Detection
uses: actions/checkout@v2

- name: Build and Run Tests
run: |
./gradlew.bat build
- name: Publish to Maven Local
run: |
./gradlew publishToMavenLocal
- name: Multi Nodes Integration Testing
run: |
./gradlew integTest -PnumNodes=3
Build-ad:
strategy:
matrix:
Expand Down
12 changes: 8 additions & 4 deletions src/test/java/org/opensearch/ad/ml/CheckpointDaoTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.charset.Charset;
import java.nio.file.Files;
Expand Down Expand Up @@ -1010,7 +1011,8 @@ private double[] getPoint(int dimensions, Random random) {
// The checkpoint used for this test is from a single-stream detector
public void testDeserializeRCFModelPreINIT() throws Exception {
// Model in file 1_3_0_rcf_model_pre_init.json not passed initialization yet
String filePath = getClass().getResource("1_3_0_rcf_model_pre_init.json").getPath();
ylwu-amzn marked this conversation as resolved.
Show resolved Hide resolved
URI uri = ClassLoader.getSystemResource("org/opensearch/ad/ml/1_3_0_rcf_model_pre_init.json").toURI();
String filePath = Paths.get(uri).toString();
String json = Files.readString(Paths.get(filePath), Charset.defaultCharset());
Map map = gson.fromJson(json, Map.class);
String model = (String) ((Map) ((Map) ((ArrayList) ((Map) map.get("hits")).get("hits")).get(0)).get("_source")).get("modelV2");
Expand All @@ -1023,7 +1025,8 @@ public void testDeserializeRCFModelPreINIT() throws Exception {
// The checkpoint used for this test is from a single-stream detector
public void testDeserializeRCFModelPostINIT() throws Exception {
// Model in file rc1_model_single_running is from RCF-3.0-rc1
String filePath = getClass().getResource("rc1_model_single_running.json").getPath();
URI uri = ClassLoader.getSystemResource("org/opensearch/ad/ml/rc1_model_single_running.json").toURI();
String filePath = Paths.get(uri).toString();
String json = Files.readString(Paths.get(filePath), Charset.defaultCharset());
Map map = gson.fromJson(json, Map.class);
String model = (String) ((Map) ((Map) ((ArrayList) ((Map) map.get("hits")).get("hits")).get(0)).get("_source")).get("modelV2");
Expand All @@ -1039,8 +1042,9 @@ public void testDeserializeRCFModelPostINIT() throws Exception {
// The scores and grades in this method were produced from AD running with RCF3.0-rc1 dependency
// and this test runs with the most recent RCF dependency that is being pulled by this project.
public void testDeserializeTRCFModel() throws Exception {
// Model in file rc1_model_single_running is from RCF-3.0-rc1
String filePath = getClass().getResource("rc1_trcf_model_direct.json").getPath();
// Model in file rc1_trcf_model_direct is a checkpoint creatd by RCF-3.0-rc1
URI uri = ClassLoader.getSystemResource("org/opensearch/ad/ml/rc1_trcf_model_direct.json").toURI();
String filePath = Paths.get(uri).toString();
String json = Files.readString(Paths.get(filePath), Charset.defaultCharset());
// For the parsing of .toTrcf to work I had to manually change "\u003d" in code back to =.
// In the byte array it doesn't seem like this is an issue but whenever reading the byte array response into a file it
Expand Down