Search in sources :

Example 1 with LatestFeedJobExecution

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

the class DataConfidenceJobsCache method fetchDataConfidenceSummary.

private List<CheckDataJob> fetchDataConfidenceSummary() {
    if (latestCache == null || needsRefresh.get()) {
        DateTime refrshStart = DateTime.now();
        latestCache = metadataAccess.read(() -> {
            List<? extends LatestFeedJobExecution> latestCheckDataJobs = opsManagerFeedProvider.findLatestCheckDataJobs();
            if (latestCheckDataJobs != null) {
                return latestCheckDataJobs.stream().map(latestFeedJobExecution -> JobModelTransform.checkDataJob(latestFeedJobExecution)).collect(Collectors.toList());
            // return new DataConfidenceSummary(checkDataJobs, 60);
            } else {
                return Collections.emptyList();
            }
        }, MetadataAccess.SERVICE);
        // reset the refresh flag including if any updates happened while we were loading
        if (needsRefreshAt != null) {
            needsRefresh.set(needsRefreshAt.isAfter(refrshStart));
        } else {
            needsRefresh.set(false);
        }
        log.debug("Loaded Data Confidence Summary from the database");
        return latestCache;
    } else {
        log.debug("Returning Cached Data Confidence Summary");
        return latestCache;
    }
}
Also used : LatestFeedJobExecution(com.thinkbiganalytics.metadata.api.feed.LatestFeedJobExecution) List(java.util.List) DateTime(org.joda.time.DateTime)

Aggregations

LatestFeedJobExecution (com.thinkbiganalytics.metadata.api.feed.LatestFeedJobExecution)1 List (java.util.List)1 DateTime (org.joda.time.DateTime)1