}
}
public String detectLate(LaterunEvent message) throws Exception {
LateDataHandler late = new LateDataHandler();
String falconInputFeeds = handler.getWfEngine().getWorkflowProperty(
message.getClusterName(), message.getWfId(), "falconInputFeeds");
String logDir = handler.getWfEngine().getWorkflowProperty(
message.getClusterName(), message.getWfId(), "logDir");
String falconInPaths = handler.getWfEngine().getWorkflowProperty(
message.getClusterName(), message.getWfId(), "falconInPaths");
String nominalTime = handler.getWfEngine().getWorkflowProperty(
message.getClusterName(), message.getWfId(), "nominalTime");
String srcClusterName = handler.getWfEngine().getWorkflowProperty(
message.getClusterName(), message.getWfId(), "srcClusterName");
Configuration conf = handler.getConfiguration(message.getClusterName(),
message.getWfId());
Path lateLogPath = handler.getLateLogPath(logDir, nominalTime,
srcClusterName);
FileSystem fs = FileSystem.get(conf);
if (!fs.exists(lateLogPath)) {
LOG.warn("Late log file:" + lateLogPath + " not found:");
return "";
}
Map<String, Long> feedSizes = new LinkedHashMap<String, Long>();
String[] pathGroups = falconInPaths.split("#");
String[] inputFeeds = falconInputFeeds.split("#");
Entity entity = EntityUtil.getEntity(message.getEntityType(),
message.getEntityName());
List<String> lateFeed = new ArrayList<String>();
if (EntityUtil.getLateProcess(entity) != null) {
for (LateInput li : EntityUtil.getLateProcess(entity)
.getLateInputs()) {
lateFeed.add(li.getInput());
}
for (int index = 0; index < pathGroups.length; index++) {
if (lateFeed.contains(inputFeeds[index])) {
long usage = 0;
for (String pathElement : pathGroups[index].split(",")) {
Path inPath = new Path(pathElement);
usage += late.usage(inPath, conf);
}
feedSizes.put(inputFeeds[index], usage);
}
}
} else {
LOG.warn("Late process is not configured for entity: "
+ message.getEntityType() + "(" + message.getEntityName()
+ ")");
}
return late.detectChanges(lateLogPath, feedSizes, conf);
}