Package org.apache.ivory.latedata

Examples of org.apache.ivory.latedata.LateDataHandler


    }

  }

  public String detectLate(LaterunEvent message) throws Exception {
    LateDataHandler late = new LateDataHandler();
    String ivoryInputFeeds = handler.getWfEngine().getWorkflowProperty(
        message.getClusterName(), message.getWfId(), "ivoryInputFeeds");
    String logDir = handler.getWfEngine().getWorkflowProperty(
        message.getClusterName(), message.getWfId(), "logDir");
    String ivoryInPaths = handler.getWfEngine().getWorkflowProperty(
        message.getClusterName(), message.getWfId(), "ivoryInPaths");
    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 = ivoryInPaths.split("#");
    String[] inputFeeds = ivoryInputFeeds.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);
  }
View Full Code Here

TOP

Related Classes of org.apache.ivory.latedata.LateDataHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.