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

Merge Single-Stream and HC Detector Profiling Workflows #1237

Merged
merged 1 commit into from
Jun 11, 2024

Conversation

kaituo
Copy link
Collaborator

@kaituo kaituo commented Jun 11, 2024

Description

Since version 2.15, we have merged the single-stream and HC detector workflows. Consequently, separate logic for profiling is no longer necessary. This PR removes single-stream specific logic from the profile runner.

During a Blue/Green (B/G) deployment, if an old node communicates with a new node regarding an old model, we will not execute RCFPollingAction to determine model updates. However, we have fallback logic that checks for anomaly results. If any results are found, the initialization progress is set to 100%.

I have retained the old AnomalyDetectorProfileRunner temporarily to facilitate writing tests for the legacy logic. This includes keeping RCFPollingAction and ModelManager.getTotalUpdates to handle requests from old nodes during the B/G deployment process.

Testing:

  • Verified that the single-stream detector works correctly with the updated profile runner.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

…lows

Since version 2.15, we have merged the single-stream and HC detector workflows. Consequently, separate logic for profiling is no longer necessary. This PR removes single-stream specific logic from the profile runner.

During a Blue/Green (B/G) deployment, if an old node communicates with a new node regarding an old model, we will not execute RCFPollingAction to determine model updates. However, we have fallback logic that checks for anomaly results. If any results are found, the initialization progress is set to 100%.

I have retained the old AnomalyDetectorProfileRunner temporarily to facilitate writing tests for the legacy logic. This includes keeping RCFPollingAction and ModelManager.getTotalUpdates to handle requests from old nodes during the B/G deployment process.

Testing:
* Verified that the single-stream detector works correctly with the updated profile runner.

Signed-off-by: Kaituo Li <[email protected]>
@kaituo
Copy link
Collaborator Author

kaituo commented Jun 11, 2024

flaky test. Will fix in the following PR due to time constraint.

REPRODUCE WITH: gradlew ':test' --tests "org.opensearch.ad.ml.EntityColdStarterTests.testCacheReleaseAfterClear" -Dtests.seed=7E8B1D478E1896C1 -Dtests.security.manager=false -Dtests.jvm.argline="-XX:TieredStopAtLevel=1 -XX:ReservedCodeCacheSize=64m" -Dtests.locale=ja-JP -Dtests.timezone=Australia/Victoria -Druntime.java=21

org.opensearch.ad.ml.EntityColdStarterTests > testCacheReleaseAfterClear FAILED
java.lang.AssertionError
at __randomizedtesting.SeedInfo.seed([7E8B1D478E1896C1:7E1FFC0D185826C2]:0)
at org.junit.Assert.fail(Assert.java:87)
at org.junit.Assert.assertTrue(Assert.java:42)
at org.junit.Assert.assertTrue(Assert.java:53)
at org.opensearch.ad.ml.EntityColdStarterTests.testCacheReleaseAfterClear(EntityColdStarterTests.java:1207)

1> [2024-06-12T07:56:10,878][INFO ][o.o.a.m.EntityColdStarterTests] [testCacheReleaseAfterClear] before test
Suite: Test class org.opensearch.ad.ml.EntityColdStarterTests
Error: 024-06-12T07:56:10,894][ERROR][o.o.t.m.ModelColdStart ] [testCacheReleaseAfterClear] Error while cold start 123_entity_abc
1> java.lang.IllegalArgumentException: incorrect discount parameter
1> at com.amazon.randomcutforest.CommonUtils.checkArgument(CommonUtils.java:44) ~[randomcutforest-core-4.0.0.jar:?]
1> at com.amazon.randomcutforest.statistics.Deviation.(Deviation.java:41) ~[randomcutforest-core-4.0.0.jar:?]
1> at com.amazon.randomcutforest.preprocessor.Preprocessor.(Preprocessor.java:233) ~[randomcutforest-core-4.0.0.jar:?]
1> at com.amazon.randomcutforest.preprocessor.InitialSegmentPreprocessor.(InitialSegmentPreprocessor.java:36) ~[randomcutforest-core-4.0.0.jar:?]
1> at com.amazon.randomcutforest.preprocessor.ImputePreprocessor.(ImputePreprocessor.java:51) ~[randomcutforest-core-4.0.0.jar:?]
1> at com.amazon.randomcutforest.preprocessor.Preprocessor$Builder.build(Preprocessor.java:985) ~[randomcutforest-core-4.0.0.jar:?]
1> at com.amazon.randomcutforest.parkservices.ThresholdedRandomCutForest.(ThresholdedRandomCutForest.java:135) ~[randomcutforest-parkservices-4.0.0.jar:?]
1> at com.amazon.randomcutforest.parkservices.ThresholdedRandomCutForest$Builder.build(ThresholdedRandomCutForest.java:669) ~[randomcutforest-parkservices-4.0.0.jar:?]
1> at org.opensearch.ad.ml.ADColdStart.trainModelFromDataSegments(ADColdStart.java:240) ~[main/:?]
1> at org.opensearch.timeseries.ml.ModelColdStart.lambda$coldStart$3(ModelColdStart.java:276) ~[main/:?]
1> at org.opensearch.core.action.ActionListener$1.onResponse(ActionListener.java:82) ~[opensearch-core-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
1> at org.opensearch.action.support.ThreadedActionListener$1.doRun(ThreadedActionListener.java:78) ~[opensearch-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
1> at org.opensearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:52) ~[opensearch-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
1> at org.opensearch.timeseries.AbstractTimeSeriesTest.lambda$setUpADThreadPool$1(AbstractTimeSeriesTest.java:503) ~[test/:?]
1> at org.mockito.internal.stubbing.StubbedInvocationMatcher.answer(StubbedInvocationMatcher.java:42) ~[mockito-core-5.9.0.jar:?]
1> at org.mockito.internal.handler.MockHandlerImpl.handle(MockHandlerImpl.java:103) ~[mockito-core-5.9.0.jar:?]
1> at org.mockito.internal.handler.NullResultGuardian.handle(NullResultGuardian.java:29) ~[mockito-core-5.9.0.jar:?]
1> at org.mockito.internal.handler.InvocationNotifierHandler.handle(InvocationNotifierHandler.java:34) ~[mockito-core-5.9.0.jar:?]
1> at org.mockito.internal.creation.bytebuddy.MockMethodInterceptor.doIntercept(MockMethodInterceptor.java:82) ~[mockito-core-5.9.0.jar:?]
1> at org.mockito.internal.creation.bytebuddy.MockMethodInterceptor.doIntercept(MockMethodInterceptor.java:56) ~[mockito-core-5.9.0.jar:?]
1> at org.mockito.internal.creation.bytebuddy.MockMethodInterceptor$DispatcherDefaultingToRealMethod.interceptAbstract(MockMethodInterceptor.java:161) ~[mockito-core-5.9.0.jar:?]
1> at org.mockito.codegen.ExecutorService$MockitoMock$4WXNOv1m.execute(Unknown Source) ~[mockito-core-5.9.0.jar:?]
1> at org.opensearch.action.support.ThreadedActionListener.onResponse(ThreadedActionListener.java:70) ~[opensearch-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
1> at org.opensearch.timeseries.ml.ModelColdStart.lambda$getFeatures$8(ModelColdStart.java:484) ~[main/:?]
1> at org.opensearch.core.action.ActionListener$1.onResponse(ActionListener.java:82) ~[opensearch-core-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
1> at org.opensearch.action.support.ThreadedActionListener$1.doRun(ThreadedActionListener.java:78) ~[opensearch-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
1> at org.opensearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:52) ~[opensearch-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
1> at org.opensearch.timeseries.AbstractTimeSeriesTest.lambda$setUpADThreadPool$1(AbstractTimeSeriesTest.java:503) ~[test/:?]
1> at org.mockito.internal.stubbing.StubbedInvocationMatcher.answer(StubbedInvocationMatcher.java:42) ~[mockito-core-5.9.0.jar:?]
1> at org.mockito.internal.handler.MockHandlerImpl.handle(MockHandlerImpl.java:103) ~[mockito-core-5.9.0.jar:?]
1> at org.mockito.internal.handler.NullResultGuardian.handle(NullResultGuardian.java:29) ~[mockito-core-5.9.0.jar:?]
1> at org.mockito.internal.handler.InvocationNotifierHandler.handle(InvocationNotifierHandler.java:34) ~[mockito-core-5.9.0.jar:?]
1> at org.mockito.internal.creation.bytebuddy.MockMethodInterceptor.doIntercept(MockMethodInterceptor.java:82) ~[mockito-core-5.9.0.jar:?]
1> at org.mockito.internal.creation.bytebuddy.MockMethodInterceptor.doIntercept(MockMethodInterceptor.java:56) ~[mockito-core-5.9.0.jar:?]
1> at org.mockito.internal.creation.bytebuddy.MockMethodInterceptor$DispatcherDefaultingToRealMethod.interceptAbstract(MockMethodInterceptor.java:161) ~[mockito-core-5.9.0.jar:?]
1> at org.mockito.codegen.ExecutorService$MockitoMock$4WXNOv1m.execute(Unknown Source) ~[mockito-core-5.9.0.jar:?]
1> at org.opensearch.action.support.ThreadedActionListener.onResponse(ThreadedActionListener.java:70) ~[opensearch-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
1> at org.opensearch.ad.ml.EntityColdStarterTests.lambda$testCacheReleaseAfterClear$23(EntityColdStarterTests.java:1191) ~[test/:?]
1> at org.mockito.internal.stubbing.StubbedInvocationMatcher.answer(StubbedInvocationMatcher.java:42) ~[mockito-core-5.9.0.jar:?]
1> at org.mockito.internal.handler.MockHandlerImpl.handle(MockHandlerImpl.java:103) ~[mockito-core-5.9.0.jar:?]
1> at org.mockito.internal.handler.NullResultGuardian.handle(NullResultGuardian.java:29) ~[mockito-core-5.9.0.jar:?]
1> at org.mockito.internal.handler.InvocationNotifierHandler.handle(InvocationNotifierHandler.java:34) ~[mockito-core-5.9.0.jar:?]
1> at org.mockito.internal.creation.bytebuddy.MockMethodInterceptor.doIntercept(MockMethodInterceptor.java:82) ~[mockito-core-5.9.0.jar:?]
1> at org.mockito.internal.creation.bytebuddy.MockMethodInterceptor.doIntercept(MockMethodInterceptor.java:56) ~[mockito-core-5.9.0.jar:?]
1> at org.mockito.internal.creation.bytebuddy.MockMethodInterceptor$DispatcherDefaultingToRealMethod.interceptSuperCallable(MockMethodInterceptor.java:145) ~[mockito-core-5.9.0.jar:?]
1> at org.opensearch.timeseries.feature.SearchFeatureDao$MockitoMock$cgmAGFYF.getColdStartSamplesForPeriods(Unknown Source) ~[main/:?]
1> at org.opensearch.timeseries.ml.ModelColdStart.getFeatures(ModelColdStart.java:503) ~[main/:?]
1> at org.opensearch.timeseries.ml.ModelColdStart.lambda$getColdStartData$6(ModelColdStart.java:369) ~[main/:?]
1> at org.opensearch.core.action.ActionListener$1.onResponse(ActionListener.java:82) ~[opensearch-core-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
1> at org.opensearch.action.support.ThreadedActionListener$1.doRun(ThreadedActionListener.java:78) ~[opensearch-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
1> at org.opensearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:52) ~[opensearch-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
1> at org.opensearch.timeseries.AbstractTimeSeriesTest.lambda$setUpADThreadPool$1(AbstractTimeSeriesTest.java:503) ~[test/:?]
1> at org.mockito.internal.stubbing.StubbedInvocationMatcher.answer(StubbedInvocationMatcher.java:42) ~[mockito-core-5.9.0.jar:?]
1> at org.mockito.internal.handler.MockHandlerImpl.handle(MockHandlerImpl.java:103) ~[mockito-core-5.9.0.jar:?]
1> at org.mockito.internal.handler.NullResultGuardian.handle(NullResultGuardian.java:29) ~[mockito-core-5.9.0.jar:?]
1> at org.mockito.internal.handler.InvocationNotifierHandler.handle(InvocationNotifierHandler.java:34) ~[mockito-core-5.9.0.jar:?]
1> at org.mockito.internal.creation.bytebuddy.MockMethodInterceptor.doIntercept(MockMethodInterceptor.java:82) ~[mockito-core-5.9.0.jar:?]
1> at org.mockito.internal.creation.bytebuddy.MockMethodInterceptor.doIntercept(MockMethodInterceptor.java:56) ~[mockito-core-5.9.0.jar:?]
1> at org.mockito.internal.creation.bytebuddy.MockMethodInterceptor$DispatcherDefaultingToRealMethod.interceptAbstract(MockMethodInterceptor.java:161) ~[mockito-core-5.9.0.jar:?]
1> at org.mockito.codegen.ExecutorService$MockitoMock$4WXNOv1m.execute(Unknown Source) ~[mockito-core-5.9.0.jar:?]
1> at org.opensearch.action.support.ThreadedActionListener.onResponse(Threaded 1> ActionListener.java:70) ~[opensearch-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
1> at org.opensearch.ad.ml.EntityColdStarterTests.lambda$testCacheReleaseAfterClear$22(EntityColdStarterTests.java:1176) ~[test/:?]
2> REPRODUCE WITH: gradlew ':test' --tests "org.opensearch.ad.ml.EntityColdStarterTests.testCacheReleaseAfterClear" -Dtests.seed=7E8B1D478E1896C1 -Dtests.security.manager=false -Dtests.jvm.argline="-XX:TieredStopAtLevel=1 -XX:ReservedCodeCacheSize=64m" -Dtests.locale=ja-JP -Dtests.timezone=Australia/Victoria -Druntime.java=21

@kaituo kaituo merged commit 54b842b into opensearch-project:main Jun 11, 2024
24 of 27 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jun 11, 2024
…lows (#1237)

Since version 2.15, we have merged the single-stream and HC detector workflows. Consequently, separate logic for profiling is no longer necessary. This PR removes single-stream specific logic from the profile runner.

During a Blue/Green (B/G) deployment, if an old node communicates with a new node regarding an old model, we will not execute RCFPollingAction to determine model updates. However, we have fallback logic that checks for anomaly results. If any results are found, the initialization progress is set to 100%.

I have retained the old AnomalyDetectorProfileRunner temporarily to facilitate writing tests for the legacy logic. This includes keeping RCFPollingAction and ModelManager.getTotalUpdates to handle requests from old nodes during the B/G deployment process.

Testing:
* Verified that the single-stream detector works correctly with the updated profile runner.

Signed-off-by: Kaituo Li <[email protected]>
(cherry picked from commit 54b842b)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
kaituo pushed a commit that referenced this pull request Jun 11, 2024
…lows (#1237) (#1239)

Since version 2.15, we have merged the single-stream and HC detector workflows. Consequently, separate logic for profiling is no longer necessary. This PR removes single-stream specific logic from the profile runner.

During a Blue/Green (B/G) deployment, if an old node communicates with a new node regarding an old model, we will not execute RCFPollingAction to determine model updates. However, we have fallback logic that checks for anomaly results. If any results are found, the initialization progress is set to 100%.

I have retained the old AnomalyDetectorProfileRunner temporarily to facilitate writing tests for the legacy logic. This includes keeping RCFPollingAction and ModelManager.getTotalUpdates to handle requests from old nodes during the B/G deployment process.

Testing:
* Verified that the single-stream detector works correctly with the updated profile runner.


(cherry picked from commit 54b842b)

Signed-off-by: Kaituo Li <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
kaituo pushed a commit to kaituo/anomaly-detection-1 that referenced this pull request Jun 11, 2024
…lows (opensearch-project#1237) (opensearch-project#1239)

Since version 2.15, we have merged the single-stream and HC detector workflows. Consequently, separate logic for profiling is no longer necessary. This PR removes single-stream specific logic from the profile runner.

During a Blue/Green (B/G) deployment, if an old node communicates with a new node regarding an old model, we will not execute RCFPollingAction to determine model updates. However, we have fallback logic that checks for anomaly results. If any results are found, the initialization progress is set to 100%.

I have retained the old AnomalyDetectorProfileRunner temporarily to facilitate writing tests for the legacy logic. This includes keeping RCFPollingAction and ModelManager.getTotalUpdates to handle requests from old nodes during the B/G deployment process.

Testing:
* Verified that the single-stream detector works correctly with the updated profile runner.


(cherry picked from commit 54b842b)

Signed-off-by: Kaituo Li <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
amitgalitz pushed a commit that referenced this pull request Jun 11, 2024
…lows (#1237) (#1239) (#1242)

Since version 2.15, we have merged the single-stream and HC detector workflows. Consequently, separate logic for profiling is no longer necessary. This PR removes single-stream specific logic from the profile runner.

During a Blue/Green (B/G) deployment, if an old node communicates with a new node regarding an old model, we will not execute RCFPollingAction to determine model updates. However, we have fallback logic that checks for anomaly results. If any results are found, the initialization progress is set to 100%.

I have retained the old AnomalyDetectorProfileRunner temporarily to facilitate writing tests for the legacy logic. This includes keeping RCFPollingAction and ModelManager.getTotalUpdates to handle requests from old nodes during the B/G deployment process.

Testing:
* Verified that the single-stream detector works correctly with the updated profile runner.


(cherry picked from commit 54b842b)

Signed-off-by: Kaituo Li <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants