Search in sources :

Example 11 with InitProgressProfile

use of org.opensearch.ad.model.InitProgressProfile in project anomaly-detection by opensearch-project.

the class EntityProfileRunner method sendInitState.

private void sendInitState(Set<EntityProfileName> profilesToCollect, Entity entityValue, AnomalyDetector detector, long updates, MultiResponsesDelegateActionListener<EntityProfile> delegateListener) {
    EntityProfile.Builder builder = new EntityProfile.Builder();
    if (profilesToCollect.contains(EntityProfileName.STATE)) {
        builder.state(EntityState.INIT);
    }
    if (profilesToCollect.contains(EntityProfileName.INIT_PROGRESS)) {
        long intervalMins = ((IntervalTimeConfiguration) detector.getDetectionInterval()).toDuration().toMinutes();
        InitProgressProfile initProgress = computeInitProgressProfile(updates, intervalMins);
        builder.initProgress(initProgress);
    }
    delegateListener.onResponse(builder.build());
}
Also used : NestedQueryBuilder(org.opensearch.index.query.NestedQueryBuilder) TermQueryBuilder(org.opensearch.index.query.TermQueryBuilder) SearchSourceBuilder(org.opensearch.search.builder.SearchSourceBuilder) BoolQueryBuilder(org.opensearch.index.query.BoolQueryBuilder) InitProgressProfile(org.opensearch.ad.model.InitProgressProfile) EntityProfile(org.opensearch.ad.model.EntityProfile)

Aggregations

InitProgressProfile (org.opensearch.ad.model.InitProgressProfile)11 AnomalyDetector (org.opensearch.ad.model.AnomalyDetector)6 AnomalyDetectorJob (org.opensearch.ad.model.AnomalyDetectorJob)6 IOException (java.io.IOException)5 ChronoUnit (java.time.temporal.ChronoUnit)5 Arrays (java.util.Arrays)5 Collections (java.util.Collections)5 Collections.emptyMap (java.util.Collections.emptyMap)5 Map (java.util.Map)5 Set (java.util.Set)5 CountDownLatch (java.util.concurrent.CountDownLatch)5 TimeUnit (java.util.concurrent.TimeUnit)5 ArgumentMatchers.any (org.mockito.ArgumentMatchers.any)5 Mockito.doAnswer (org.mockito.Mockito.doAnswer)5 ActionListener (org.opensearch.action.ActionListener)5 GetRequest (org.opensearch.action.get.GetRequest)5 GetResponse (org.opensearch.action.get.GetResponse)5 CommonErrorMessages (org.opensearch.ad.constant.CommonErrorMessages)5 CommonName (org.opensearch.ad.constant.CommonName)5 ADTask (org.opensearch.ad.model.ADTask)5