Search in sources :

Example 1 with DefaultFeedHealth

use of com.thinkbiganalytics.jobrepo.query.model.DefaultFeedHealth in project kylo by Teradata.

the class FeedModelTransform method feedHealth.

/**
 * Transform the FeedHealth domain object to the REST friendly FeedHealth object
 *
 * @return the transformed FeedHealth object
 */
public static FeedHealth feedHealth(FeedSummary domain) {
    FeedHealth feedHealth = new DefaultFeedHealth();
    feedHealth.setUnhealthyCount(domain.getFailedCount());
    feedHealth.setHealthyCount(domain.getCompletedCount());
    feedHealth.setFeed(domain.getFeedName());
    feedHealth.setFeedId(domain.getFeedId() != null ? domain.getFeedId().toString() : null);
    feedHealth.setLastOpFeed(executedFeed(domain));
    feedHealth.setStream(domain.isStream());
    feedHealth.setRunningCount(domain.getRunningCount());
    return feedHealth;
}
Also used : DefaultFeedHealth(com.thinkbiganalytics.jobrepo.query.model.DefaultFeedHealth) FeedHealth(com.thinkbiganalytics.jobrepo.query.model.FeedHealth) DefaultFeedHealth(com.thinkbiganalytics.jobrepo.query.model.DefaultFeedHealth)

Example 2 with DefaultFeedHealth

use of com.thinkbiganalytics.jobrepo.query.model.DefaultFeedHealth in project kylo by Teradata.

the class FeedHealthUtil method parseToList.

public static List<FeedHealth> parseToList(List<ExecutedFeed> latestOpFeeds, Map<String, Long> avgRunTimes) {
    List<FeedHealth> list = new ArrayList<FeedHealth>();
    Map<String, FeedHealth> map = new HashMap<String, FeedHealth>();
    if (latestOpFeeds != null) {
        for (ExecutedFeed feed : latestOpFeeds) {
            String feedName = feed.getName();
            FeedHealth feedHealth = map.get(feedName);
            if (feedHealth == null) {
                feedHealth = new DefaultFeedHealth();
                feedHealth.setFeed(feedName);
                if (avgRunTimes != null) {
                    feedHealth.setAvgRuntime(avgRunTimes.get(feedName));
                }
                list.add(feedHealth);
                map.put(feedName, feedHealth);
            }
            feedHealth.setLastOpFeed(feed);
        }
    }
    return list;
}
Also used : DefaultFeedHealth(com.thinkbiganalytics.jobrepo.query.model.DefaultFeedHealth) ExecutedFeed(com.thinkbiganalytics.jobrepo.query.model.ExecutedFeed) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) FeedHealth(com.thinkbiganalytics.jobrepo.query.model.FeedHealth) DefaultFeedHealth(com.thinkbiganalytics.jobrepo.query.model.DefaultFeedHealth)

Example 3 with DefaultFeedHealth

use of com.thinkbiganalytics.jobrepo.query.model.DefaultFeedHealth in project kylo by Teradata.

the class FeedModelTransform method feedHealth.

/**
 * Transforms the feed object to the REST friendly FeedHealth object, assuming the feed has not yet executed.
 *
 * @param domain the feed object
 * @return the transformed FeedHealth object
 */
@Nonnull
public static FeedHealth feedHealth(@Nonnull final OpsManagerFeed domain) {
    final FeedHealth feedHealth = new DefaultFeedHealth();
    feedHealth.setUnhealthyCount(0L);
    feedHealth.setHealthyCount(0L);
    feedHealth.setFeed(domain.getName());
    feedHealth.setFeedId(domain.getId() != null ? domain.getId().toString() : null);
    feedHealth.setStream(domain.isStream());
    return feedHealth;
}
Also used : DefaultFeedHealth(com.thinkbiganalytics.jobrepo.query.model.DefaultFeedHealth) FeedHealth(com.thinkbiganalytics.jobrepo.query.model.FeedHealth) DefaultFeedHealth(com.thinkbiganalytics.jobrepo.query.model.DefaultFeedHealth) Nonnull(javax.annotation.Nonnull)

Example 4 with DefaultFeedHealth

use of com.thinkbiganalytics.jobrepo.query.model.DefaultFeedHealth in project kylo by Teradata.

the class FeedModelTransform method feedHealth.

/**
 * Transform the FeedHealth domain object to the REST friendly FeedHealth object
 *
 * @return the transformed FeedHealth object
 */
public static FeedHealth feedHealth(com.thinkbiganalytics.metadata.api.feed.FeedHealth domain) {
    FeedHealth feedHealth = new DefaultFeedHealth();
    feedHealth.setUnhealthyCount(domain.getFailedCount());
    feedHealth.setHealthyCount(domain.getCompletedCount());
    feedHealth.setFeed(domain.getFeedName());
    feedHealth.setFeedId(domain.getFeedId() != null ? domain.getFeedId().toString() : null);
    feedHealth.setLastOpFeed(executedFeed(domain));
    feedHealth.setStream(domain.isStream());
    feedHealth.setRunningCount(domain.getRunningCount());
    return feedHealth;
}
Also used : DefaultFeedHealth(com.thinkbiganalytics.jobrepo.query.model.DefaultFeedHealth) FeedHealth(com.thinkbiganalytics.jobrepo.query.model.FeedHealth) DefaultFeedHealth(com.thinkbiganalytics.jobrepo.query.model.DefaultFeedHealth)

Aggregations

DefaultFeedHealth (com.thinkbiganalytics.jobrepo.query.model.DefaultFeedHealth)4 FeedHealth (com.thinkbiganalytics.jobrepo.query.model.FeedHealth)4 ExecutedFeed (com.thinkbiganalytics.jobrepo.query.model.ExecutedFeed)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Nonnull (javax.annotation.Nonnull)1