Skip to content

Commit

Permalink
[Backport 2.x] Add Feature Filtering in Model Validation (#1261)
Browse files Browse the repository at this point in the history
* Consider feature filter in model validation (#1258)

Signed-off-by: Kaituo Li <[email protected]>

* follow opensearch-project/k-NN#1795

Signed-off-by: Kaituo Li <[email protected]>

---------

Signed-off-by: Kaituo Li <[email protected]>
  • Loading branch information
kaituo authored Jul 8, 2024
1 parent a64a859 commit e2c821f
Show file tree
Hide file tree
Showing 43 changed files with 2,516 additions and 569 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/add-untriaged.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
issues:
types: [opened, reopened, transferred]

env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true

jobs:
apply-label:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/auto-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
tags:
- '*'

env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true

jobs:
build:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/backport.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
- closed
- labeled

env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true

jobs:
backport:
if: github.event.pull_request.merged == true
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
branches:
- "*"

env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true

jobs:
Get-CI-Image-Tag:
uses: opensearch-project/opensearch-build/.github/workflows/get-ci-image-tag.yml@main
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/delete_backport_branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ on:
pull_request:
types:
- closed


env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true

jobs:
delete-branch:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/draft-release-notes-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
branches:
- main

env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true

jobs:
update_release_draft:
name: Update draft release notes
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
types:
- opened

env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true

jobs:
label:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/link-check-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
pull_request:
branches: [main]

env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true

jobs:
linkchecker:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/maven-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
- '1.*'
- '2.*'

env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true

jobs:
build-and-publish-snapshots:
strategy:
Expand Down
30 changes: 13 additions & 17 deletions .github/workflows/test_build_multi_platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
branches:
- "*"

env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true

jobs:
Get-CI-Image-Tag:
uses: opensearch-project/opensearch-build/.github/workflows/get-ci-image-tag.yml@main
Expand Down Expand Up @@ -53,19 +56,14 @@ jobs:
- name: Multi Nodes Integration Testing
run: |
./gradlew integTest -PnumNodes=3
- name: Upload Coverage Report
uses: codecov/codecov-action@v3
with:
file: ./build/reports/jacoco/test/jacocoTestReport.xml
flags: plugin
Build-ad-linux:
needs: [Get-CI-Image-Tag, spotless]
strategy:
matrix:
java: [11, 17, 21]
fail-fast: false
name: Build and Test Anomaly detection Plugin
name: Build and Test Anomaly detection Plugin on Linux
runs-on: ubuntu-latest
container:
# using the same image which is used by opensearch-build team to build the OpenSearch Distribution
Expand Down Expand Up @@ -94,11 +92,6 @@ jobs:
./gradlew build -x spotlessJava &&
./gradlew publishToMavenLocal &&
./gradlew integTest -PnumNodes=3"
- name: Upload Coverage Report
uses: codecov/codecov-action@v3
with:
file: ./build/reports/jacoco/test/jacocoTestReport.xml
flags: plugin
Build-ad-macos:
needs: spotless
Expand All @@ -107,7 +100,7 @@ jobs:
java: [11,17,21]
fail-fast: false

name: Build and Test Anomaly detection Plugin
name: Build and Test Anomaly detection Plugin on MacOS
runs-on: macos-13
env:
JENKINS_URL: build.ci.opensearch.org
Expand All @@ -128,14 +121,17 @@ jobs:
- name: Build and Run Tests
run: |
./gradlew build -x spotlessJava
# coverage.gradle is only applied in single local node test
- name: Upload Coverage Report
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
file: ./build/reports/jacoco/test/jacocoTestReport.xml
flags: plugin
- name: Publish to Maven Local
run: |
./gradlew publishToMavenLocal
- name: Multi Nodes Integration Testing
run: |
./gradlew integTest -PnumNodes=3
- name: Upload Coverage Report
uses: codecov/codecov-action@v3
with:
file: ./build/reports/jacoco/test/jacocoTestReport.xml
flags: plugin
3 changes: 3 additions & 0 deletions .github/workflows/test_bwc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
branches:
- "*"

env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true

jobs:
Get-CI-Image-Tag:
uses: opensearch-project/opensearch-build/.github/workflows/get-ci-image-tag.yml@main
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/test_security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
branches:
- "*"

env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true

jobs:
Build-ad:
strategy:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public class ADCommonMessages {
public static String DETECTOR_IS_RUNNING = "Detector is already running";
public static String DETECTOR_MISSING = "Detector is missing";
public static String AD_TASK_ACTION_MISSING = "AD task action is missing";
public static final String INDEX_NOT_FOUND = "index does not exist";
public static final String UNSUPPORTED_PROFILE_TYPE = "Unsupported profile types";

public static final String REQUEST_THROTTLED_MSG = "Request throttled. Please try again later.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.opensearch.core.xcontent.NamedXContentRegistry;
import org.opensearch.timeseries.AnalysisType;
import org.opensearch.timeseries.feature.SearchFeatureDao;
import org.opensearch.timeseries.model.ValidationIssueType;
import org.opensearch.timeseries.rest.handler.ModelValidationActionHandler;
import org.opensearch.timeseries.transport.ValidateConfigResponse;
import org.opensearch.timeseries.util.SecurityClientUtil;
Expand Down Expand Up @@ -50,7 +51,8 @@ public ADModelValidationActionHandler(
clock,
settings,
user,
AnalysisType.AD
AnalysisType.AD,
ValidationIssueType.DETECTION_INTERVAL
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.opensearch.rest.RestRequest;
import org.opensearch.timeseries.feature.SearchFeatureDao;
import org.opensearch.timeseries.model.Config;
import org.opensearch.timeseries.model.ValidationAspect;
import org.opensearch.timeseries.rest.handler.Processor;
import org.opensearch.timeseries.transport.BaseValidateConfigTransportAction;
import org.opensearch.timeseries.transport.ValidateConfigRequest;
Expand Down Expand Up @@ -61,7 +62,8 @@ public ValidateAnomalyDetectorTransportAction(
actionFilters,
transportService,
searchFeatureDao,
AD_FILTER_BY_BACKEND_ROLES
AD_FILTER_BY_BACKEND_ROLES,
ValidationAspect.DETECTOR
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.opensearch.forecast.model.Forecaster;
import org.opensearch.timeseries.AnalysisType;
import org.opensearch.timeseries.feature.SearchFeatureDao;
import org.opensearch.timeseries.model.ValidationIssueType;
import org.opensearch.timeseries.rest.handler.ModelValidationActionHandler;
import org.opensearch.timeseries.transport.ValidateConfigResponse;
import org.opensearch.timeseries.util.SecurityClientUtil;
Expand Down Expand Up @@ -50,7 +51,8 @@ public ForecastModelValidationActionHandler(
clock,
settings,
user,
AnalysisType.FORECAST
AnalysisType.FORECAST,
ValidationIssueType.FORECAST_INTERVAL
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.opensearch.rest.RestRequest;
import org.opensearch.timeseries.feature.SearchFeatureDao;
import org.opensearch.timeseries.model.Config;
import org.opensearch.timeseries.model.ValidationAspect;
import org.opensearch.timeseries.rest.handler.Processor;
import org.opensearch.timeseries.transport.BaseValidateConfigTransportAction;
import org.opensearch.timeseries.transport.ValidateConfigRequest;
Expand Down Expand Up @@ -55,7 +56,8 @@ public ValidateForecasterTransportAction(
actionFilters,
transportService,
searchFeatureDao,
FORECAST_FILTER_BY_BACKEND_ROLES
FORECAST_FILTER_BY_BACKEND_ROLES,
ValidationAspect.FORECASTER
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ public static String getTooManyCategoricalFieldErr(int limit) {
public static String TIME_FIELD_NOT_ENOUGH_HISTORICAL_DATA =
"There isn't enough historical data found with current timefield selected.";
public static String CATEGORY_FIELD_TOO_SPARSE =
"Data is most likely too sparse with the given category fields. Consider revising category field/s or ingesting more data ";
"Data is most likely too sparse with the given category fields. Consider revising category field/s or ingesting more data.";
public static String WINDOW_DELAY_REC =
"Latest seen data point is at least %d minutes ago, consider changing window delay to at least %d minutes.";
"Latest seen data point is at least %d minutes ago. Consider changing window delay to at least %d minutes.";
public static String INTERVAL_REC = "The selected interval might collect sparse data. Consider changing interval length to: ";
public static String RAW_DATA_TOO_SPARSE =
"Source index data is potentially too sparse for model training. Consider changing interval length or ingesting more data";
Expand All @@ -65,13 +65,14 @@ public static String getTooManyCategoricalFieldErr(int limit) {
public static String CATEGORY_FIELD_NO_DATA =
"No entity was found with the given categorical fields. Consider revising category field/s or ingesting more data";
public static String FEATURE_QUERY_TOO_SPARSE =
"Data is most likely too sparse when given feature queries are applied. Consider revising feature queries.";
"Data is most likely too sparse when given feature queries are applied. Consider revising feature queries";
public static String TIMEOUT_ON_INTERVAL_REC = "Timed out getting interval recommendation";
public static final String NOT_EXISTENT_VALIDATION_TYPE = "The given validation type doesn't exist";
public static final String NOT_EXISTENT_SUGGEST_TYPE = "The given suggest type doesn't exist";
public static final String DESCRIPTION_LENGTH_TOO_LONG = "Description length is too long. Max length is "
+ TimeSeriesSettings.MAX_DESCRIPTION_LENGTH
+ " characters.";
public static final String INDEX_NOT_FOUND = "index does not exist";

// ======================================
// Index message
Expand Down
Loading

0 comments on commit e2c821f

Please sign in to comment.