use of co.cask.cdap.internal.app.runtime.schedule.trigger.PartitionTrigger in project cdap by caskdata.
the class JobQueueDataset method isTriggerSatisfied.
private boolean isTriggerSatisfied(Trigger trigger, List<Notification> notifications) {
if (trigger instanceof TimeTrigger || trigger instanceof StreamSizeTrigger) {
// is initially created
return true;
}
if (trigger instanceof PartitionTrigger) {
PartitionTrigger partitionTrigger = (PartitionTrigger) trigger;
int numPartitions = 0;
for (Notification notification : notifications) {
String numPartitionsString = notification.getProperties().get("numPartitions");
numPartitions += Integer.parseInt(numPartitionsString);
}
return numPartitions >= partitionTrigger.getNumPartitions();
}
throw new IllegalArgumentException("Unknown trigger class: " + trigger.getClass());
}
Aggregations