use of org.opensearch.ad.transport.ProfileRequest in project anomaly-detection by opensearch-project.
the class AnomalyDetectorJobRunner method updateRealtimeTask.
private void updateRealtimeTask(AnomalyResultResponse response, String detectorId) {
if (response.isHCDetector() != null && response.isHCDetector() && !adTaskManager.skipUpdateHCRealtimeTask(detectorId, response.getError())) {
DiscoveryNode[] dataNodes = nodeFilter.getEligibleDataNodes();
Set<DetectorProfileName> profiles = new HashSet<>();
profiles.add(DetectorProfileName.INIT_PROGRESS);
ProfileRequest profileRequest = new ProfileRequest(detectorId, profiles, true, dataNodes);
client.execute(ProfileAction.INSTANCE, profileRequest, ActionListener.wrap(r -> {
log.debug("Update latest realtime task for HC detector {}, total updates: {}", detectorId, r.getTotalUpdates());
updateLatestRealtimeTask(detectorId, null, r.getTotalUpdates(), response.getDetectorIntervalInMinutes(), response.getError());
}, e -> {
log.error("Failed to update latest realtime task for " + detectorId, e);
}));
} else {
log.debug("Update latest realtime task for SINGLE detector {}, total updates: {}", detectorId, response.getRcfTotalUpdates());
updateLatestRealtimeTask(detectorId, null, response.getRcfTotalUpdates(), response.getDetectorIntervalInMinutes(), response.getError());
}
}
use of org.opensearch.ad.transport.ProfileRequest in project anomaly-detection by opensearch-project.
the class AnomalyDetectorProfileRunner method profileModels.
private void profileModels(AnomalyDetector detector, Set<DetectorProfileName> profiles, AnomalyDetectorJob job, boolean forMultiEntityDetector, MultiResponsesDelegateActionListener<DetectorProfile> listener) {
DiscoveryNode[] dataNodes = nodeFilter.getEligibleDataNodes();
ProfileRequest profileRequest = new ProfileRequest(detector.getDetectorId(), profiles, forMultiEntityDetector, dataNodes);
// get init progress
client.execute(ProfileAction.INSTANCE, profileRequest, onModelResponse(detector, profiles, job, listener));
}
Aggregations