Search in sources :

Example 1 with PreconditionTriggerEvent

use of com.thinkbiganalytics.metadata.api.event.feed.PreconditionTriggerEvent in project kylo by Teradata.

the class FeedPreconditionService method checkPrecondition.

private void checkPrecondition(Feed feed, OperationStatus operationStatus) {
    FeedPrecondition precond = feed.getPrecondition();
    if (precond != null) {
        log.debug("Checking precondition of feed: {} ({})", feed.getName(), feed.getId());
        ServiceLevelAgreement sla = precond.getAgreement();
        boolean isAssess = sla.getAllMetrics().stream().anyMatch(metric -> isMetricDependentOnStatus(metric, operationStatus));
        if (isAssess) {
            ServiceLevelAssessment assessment = this.assessor.assess(sla);
            if (assessment.getResult() == AssessmentResult.SUCCESS) {
                log.info("Firing precondition trigger event for feed:{} ({})", feed.getName(), feed.getId());
                this.eventService.notify(new PreconditionTriggerEvent(feed.getId()));
            }
        } else {
            log.debug("Feed {}.{} does not depend on feed {}", feed.getCategory(), feed.getName(), operationStatus.getFeedName());
        }
    }
}
Also used : ServiceLevelAssessment(com.thinkbiganalytics.metadata.sla.api.ServiceLevelAssessment) PreconditionTriggerEvent(com.thinkbiganalytics.metadata.api.event.feed.PreconditionTriggerEvent) FeedPrecondition(com.thinkbiganalytics.metadata.api.feed.FeedPrecondition) ServiceLevelAgreement(com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreement)

Aggregations

PreconditionTriggerEvent (com.thinkbiganalytics.metadata.api.event.feed.PreconditionTriggerEvent)1 FeedPrecondition (com.thinkbiganalytics.metadata.api.feed.FeedPrecondition)1 ServiceLevelAgreement (com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreement)1 ServiceLevelAssessment (com.thinkbiganalytics.metadata.sla.api.ServiceLevelAssessment)1