Search in sources :

Example 1 with WithinSchedule

use of com.thinkbiganalytics.metadata.api.sla.WithinSchedule in project kylo by Teradata.

the class FeedExecutedSinceFeedsOrTime method buildPreconditionObligations.

@Override
public Set<com.thinkbiganalytics.metadata.rest.model.sla.ObligationGroup> buildPreconditionObligations() {
    Set<com.thinkbiganalytics.metadata.rest.model.sla.ObligationGroup> preconditionGroups = new HashSet<>();
    preconditionGroups.addAll(super.buildPreconditionObligations());
    try {
        Period p = new Period(0, 0, 1, 0);
        String withinPeriod = p.toString();
        WithinSchedule metric = new WithinSchedule(cronExpression, withinPeriod);
        Obligation obligation = new Obligation();
        obligation.setMetrics(Lists.newArrayList(metric));
        com.thinkbiganalytics.metadata.rest.model.sla.ObligationGroup group = new com.thinkbiganalytics.metadata.rest.model.sla.ObligationGroup();
        group.addObligation(obligation);
        group.setCondition(ObligationGroup.Condition.SUFFICIENT.name());
        preconditionGroups.add(group);
    } catch (ParseException e) {
    }
    return preconditionGroups;
}
Also used : Obligation(com.thinkbiganalytics.metadata.rest.model.sla.Obligation) Period(org.joda.time.Period) WithinSchedule(com.thinkbiganalytics.metadata.api.sla.WithinSchedule) ParseException(java.text.ParseException) ObligationGroup(com.thinkbiganalytics.metadata.sla.api.ObligationGroup) HashSet(java.util.HashSet)

Example 2 with WithinSchedule

use of com.thinkbiganalytics.metadata.api.sla.WithinSchedule in project kylo by Teradata.

the class DebugController method exampleMetrics.

/**
 * returns a list of metrics for debugging
 *
 * @return a list of metrics
 */
@GET
@Path("metrics")
@Produces(MediaType.APPLICATION_JSON)
public List<Metric> exampleMetrics() {
    List<Metric> metrics = new ArrayList<>();
    FeedExecutedSinceSchedule feedExecutedSinceSchedule = null;
    try {
        feedExecutedSinceSchedule = new FeedExecutedSinceSchedule("category", "Feed", "* * * * * ? *");
        metrics.add(feedExecutedSinceSchedule);
        WithinSchedule withinSchedule = new com.thinkbiganalytics.metadata.api.sla.WithinSchedule("* * * * * ? *", "4 hours");
        metrics.add(withinSchedule);
    } catch (ParseException e) {
        throw new RuntimeException(e);
    }
    return metrics;
}
Also used : ArrayList(java.util.ArrayList) FeedExecutedSinceSchedule(com.thinkbiganalytics.metadata.api.sla.FeedExecutedSinceSchedule) Metric(com.thinkbiganalytics.metadata.sla.api.Metric) ParseException(java.text.ParseException) WithinSchedule(com.thinkbiganalytics.metadata.api.sla.WithinSchedule) Path(javax.ws.rs.Path) JcrPath(com.thinkbiganalytics.metadata.modeshape.support.JcrPath) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Aggregations

WithinSchedule (com.thinkbiganalytics.metadata.api.sla.WithinSchedule)2 ParseException (java.text.ParseException)2 FeedExecutedSinceSchedule (com.thinkbiganalytics.metadata.api.sla.FeedExecutedSinceSchedule)1 JcrPath (com.thinkbiganalytics.metadata.modeshape.support.JcrPath)1 Obligation (com.thinkbiganalytics.metadata.rest.model.sla.Obligation)1 Metric (com.thinkbiganalytics.metadata.sla.api.Metric)1 ObligationGroup (com.thinkbiganalytics.metadata.sla.api.ObligationGroup)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 Period (org.joda.time.Period)1