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

Fix build error due to upstream change #316

Merged
merged 5 commits into from
Jun 6, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
export FC=/usr/local/Cellar/gcc/12.2.0/bin/gfortran
- name: Run build
run: |
./gradlew build
./gradlew build -Dos.arch=x86_64

build-windows:
strategy:
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ dependencies {
// Plugin dependencies
compileOnly group: 'org.opensearch', name:'opensearch-ml-client', version: "${opensearch_build}"
implementation fileTree(dir: jsJarDirectory, include: ["opensearch-job-scheduler-${opensearch_build}.jar"])
implementation fileTree(dir: adJarDirectory, include: ["opensearch-time-series-analytics-${opensearch_build}.jar"])
implementation fileTree(dir: adJarDirectory, include: ["opensearch-anomaly-detection-${opensearch_build}.jar"])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AD team plans to change the jar name from opensearch-anomaly-detection to opensearch-time-series-analytics, but main and 2.x and release branch are not consistent, during 2.14 release, this inconsistency caused skills failed to build. @kaituo can you confirm which name will be using in main and 2.x in 2.15 release?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on latest main, @kaituo changed back to opensearch-anomaly-detection in #1210

implementation fileTree(dir: sqlJarDirectory, include: ["opensearch-sql-${opensearch_build}.jar", "ppl-${opensearch_build}.jar", "protocol-${opensearch_build}.jar"])
compileOnly "org.opensearch:common-utils:${opensearch_build}"
compileOnly "org.jetbrains.kotlin:kotlin-stdlib:${kotlin_version}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ public <T> void run(Map<String, String> parameters, ActionListener<T> listener)
alertIndex,
monitorIds,
workflowIds,
alertIds
alertIds,
null
);

// create response listener
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import org.opensearch.action.search.SearchResponse;
import org.opensearch.ad.client.AnomalyDetectionNodeClient;
import org.opensearch.ad.model.ADTask;
import org.opensearch.ad.transport.GetAnomalyDetectorRequest;
import org.opensearch.ad.transport.GetAnomalyDetectorResponse;
import org.opensearch.agent.tools.utils.ToolConstants;
import org.opensearch.agent.tools.utils.ToolConstants.DetectorStateString;
Expand All @@ -41,6 +40,7 @@
import org.opensearch.search.SearchHit;
import org.opensearch.search.builder.SearchSourceBuilder;
import org.opensearch.search.sort.SortOrder;
import org.opensearch.timeseries.transport.GetConfigRequest;

import lombok.Getter;
import lombok.Setter;
Expand Down Expand Up @@ -164,7 +164,7 @@ public <T> void run(Map<String, String> parameters, ActionListener<T> listener)
listener.onFailure(e);
});

GetAnomalyDetectorRequest profileRequest = new GetAnomalyDetectorRequest(
GetConfigRequest profileRequest = new GetConfigRequest(
hit.getId(),
Versions.MATCH_ANY,
false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ public void setup() {
Collections.emptyList(),
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void setup() {
new CronSchedule("31 * * * *", ZoneId.of("Asia/Kolkata"), null),
Instant.now(),
Instant.now(),
Monitor.MonitorType.QUERY_LEVEL_MONITOR,
Monitor.MonitorType.QUERY_LEVEL_MONITOR.getValue(),
new User("test-user", Collections.emptyList(), Collections.emptyList(), Collections.emptyList()),
0,
Collections.emptyList(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.Locale;

import org.junit.After;
import org.junit.Before;
Expand Down Expand Up @@ -71,9 +72,9 @@ public void testSearchAnomalyDetectorsToolInFlowAgent_detectorNameParam() {

String agentInput2 = "{\"parameters\":{\"detectorName\": \"" + detectorName + "\"}}";
String result2 = executeAgent(agentId, agentInput2);
assertTrue(result2.contains(String.format("id=%s", detectorId)));
assertTrue(result2.contains(String.format("name=%s", detectorName)));
assertTrue(result2.contains(String.format("TotalAnomalyDetectors=%d", 1)));
assertTrue(result2.contains(String.format(Locale.ROOT, "id=%s", detectorId)));
assertTrue(result2.contains(String.format(Locale.ROOT, "name=%s", detectorName)));
assertTrue(result2.contains(String.format(Locale.ROOT, "TotalAnomalyDetectors=%d", 1)));
} finally {
if (detectorId != null) {
deleteDetector(detectorId);
Expand All @@ -95,9 +96,9 @@ public void testSearchAnomalyDetectorsToolInFlowAgent_detectorNamePatternParam()

String agentInput2 = "{\"parameters\":{\"detectorNamePattern\": \"" + detectorName + "*" + "\"}}";
String result2 = executeAgent(agentId, agentInput2);
assertTrue(result2.contains(String.format("id=%s", detectorId)));
assertTrue(result2.contains(String.format("name=%s", detectorName)));
assertTrue(result2.contains(String.format("TotalAnomalyDetectors=%d", 1)));
assertTrue(result2.contains(String.format(Locale.ROOT, "id=%s", detectorId)));
assertTrue(result2.contains(String.format(Locale.ROOT, "name=%s", detectorName)));
assertTrue(result2.contains(String.format(Locale.ROOT, "TotalAnomalyDetectors=%d", 1)));
} finally {
if (detectorId != null) {
deleteDetector(detectorId);
Expand All @@ -120,7 +121,7 @@ public void testSearchAnomalyDetectorsToolInFlowAgent_indicesParam() {

String agentInput2 = "{\"parameters\":{\"indices\": \"test-index\"}}";
String result2 = executeAgent(agentId, agentInput2);
assertTrue(result2.contains(String.format("TotalAnomalyDetectors=%d", 1)));
assertTrue(result2.contains(String.format(Locale.ROOT, "TotalAnomalyDetectors=%d", 1)));
} finally {
if (detectorId != null) {
deleteDetector(detectorId);
Expand All @@ -143,9 +144,9 @@ public void testSearchAnomalyDetectorsToolInFlowAgent_highCardinalityParam() {

String agentInput2 = "{\"parameters\":{\"highCardinality\": \"false\"}}";
String result2 = executeAgent(agentId, agentInput2);
assertTrue(result2.contains(String.format("id=%s", detectorId)));
assertTrue(result2.contains(String.format("name=%s", detectorName)));
assertTrue(result2.contains(String.format("TotalAnomalyDetectors=%d", 1)));
assertTrue(result2.contains(String.format(Locale.ROOT, "id=%s", detectorId)));
assertTrue(result2.contains(String.format(Locale.ROOT, "name=%s", detectorName)));
assertTrue(result2.contains(String.format(Locale.ROOT, "TotalAnomalyDetectors=%d", 1)));
} finally {
if (detectorId != null) {
deleteDetector(detectorId);
Expand All @@ -172,45 +173,45 @@ public void testSearchAnomalyDetectorsToolInFlowAgent_detectorStateParams() {
String agentId = createAgent(registerAgentRequestBody);
String agentInput = "{\"parameters\":{\"running\": \"true\"}}";
String result = executeAgent(agentId, agentInput);
assertTrue(result.contains(String.format("TotalAnomalyDetectors=%d", 1)));
assertTrue(result.contains(String.format(Locale.ROOT, "TotalAnomalyDetectors=%d", 1)));
assertTrue(result.contains(detectorIdRunning));

String agentInput2 = "{\"parameters\":{\"running\": \"false\"}}";
String result2 = executeAgent(agentId, agentInput2);
assertTrue(result2.contains(String.format("TotalAnomalyDetectors=%d", 2)));
assertTrue(result2.contains(String.format(Locale.ROOT, "TotalAnomalyDetectors=%d", 2)));
assertTrue(result2.contains(detectorIdDisabled1));
assertTrue(result2.contains(detectorIdDisabled2));

String agentInput3 = "{\"parameters\":{\"failed\": \"true\"}}";
String result3 = executeAgent(agentId, agentInput3);
assertTrue(result3.contains(String.format("TotalAnomalyDetectors=%d", 0)));
assertTrue(result3.contains(String.format(Locale.ROOT, "TotalAnomalyDetectors=%d", 0)));

String agentInput4 = "{\"parameters\":{\"failed\": \"false\"}}";
String result4 = executeAgent(agentId, agentInput4);
assertTrue(result4.contains(String.format("TotalAnomalyDetectors=%d", 3)));
assertTrue(result4.contains(String.format(Locale.ROOT, "TotalAnomalyDetectors=%d", 3)));
assertTrue(result4.contains(detectorIdRunning));
assertTrue(result4.contains(detectorIdDisabled1));
assertTrue(result4.contains(detectorIdDisabled2));

String agentInput5 = "{\"parameters\":{\"running\": \"true\", \"failed\": \"true\"}}";
String result5 = executeAgent(agentId, agentInput5);
assertTrue(result5.contains(String.format("TotalAnomalyDetectors=%d", 1)));
assertTrue(result5.contains(String.format(Locale.ROOT, "TotalAnomalyDetectors=%d", 1)));
assertTrue(result5.contains(detectorIdRunning));

String agentInput6 = "{\"parameters\":{\"running\": \"true\", \"failed\": \"false\"}}";
String result6 = executeAgent(agentId, agentInput6);
assertTrue(result6.contains(String.format("TotalAnomalyDetectors=%d", 1)));
assertTrue(result6.contains(String.format(Locale.ROOT, "TotalAnomalyDetectors=%d", 1)));
assertTrue(result6.contains(detectorIdRunning));

String agentInput7 = "{\"parameters\":{\"running\": \"false\", \"failed\": \"true\"}}";
String result7 = executeAgent(agentId, agentInput7);
assertTrue(result7.contains(String.format("TotalAnomalyDetectors=%d", 2)));
assertTrue(result7.contains(String.format(Locale.ROOT, "TotalAnomalyDetectors=%d", 2)));
assertTrue(result7.contains(detectorIdDisabled1));
assertTrue(result7.contains(detectorIdDisabled2));

String agentInput8 = "{\"parameters\":{\"running\": \"false\", \"failed\": \"false\"}}";
String result8 = executeAgent(agentId, agentInput8);
assertTrue(result8.contains(String.format("TotalAnomalyDetectors=%d", 2)));
assertTrue(result8.contains(String.format(Locale.ROOT, "TotalAnomalyDetectors=%d", 2)));
assertTrue(result8.contains(detectorIdDisabled1));
assertTrue(result8.contains(detectorIdDisabled2));
} finally {
Expand Down Expand Up @@ -243,9 +244,9 @@ public void testSearchAnomalyDetectorsToolInFlowAgent_complexParams() {
+ detectorName
+ "\", \"highCardinality\": false, \"sortOrder\": \"asc\", \"sortString\": \"name.keyword\", \"size\": 10, \"startIndex\": 0 }}";
String result = executeAgent(agentId, agentInput);
assertTrue(result.contains(String.format("id=%s", detectorId)));
assertTrue(result.contains(String.format("name=%s", detectorName)));
assertTrue(result.contains(String.format("TotalAnomalyDetectors=%d", 1)));
assertTrue(result.contains(String.format(Locale.ROOT, "id=%s", detectorId)));
assertTrue(result.contains(String.format(Locale.ROOT, "name=%s", detectorName)));
assertTrue(result.contains(String.format(Locale.ROOT, "TotalAnomalyDetectors=%d", 1)));
} finally {
if (detectorId != null) {
deleteDetector(detectorId);
Expand Down
Loading