Examples of LateDataHandler


Examples of org.apache.falcon.latedata.LateDataHandler

        }

    }

    public String detectLate(LaterunEvent message) throws Exception {
        LateDataHandler late = new LateDataHandler();
        Properties properties = handler.getWfEngine().getWorkflowProperties(
                message.getClusterName(), message.getWfId());
        String falconInputFeeds = properties.getProperty("falconInputFeeds");
        String falconInPaths = properties.getProperty("falconInPaths");
        String falconInputFeedStorageTypes = properties.getProperty("falconInputFeedStorageTypes");
        String logDir = properties.getProperty("logDir");
        String nominalTime = properties.getProperty("nominalTime");
        String srcClusterName = properties.getProperty("srcClusterName");
        Path lateLogPath = handler.getLateLogPath(logDir, nominalTime, srcClusterName);

        final String storageEndpoint = properties.getProperty(AbstractWorkflowEngine.NAME_NODE);
        Configuration conf = LateRerunHandler.getConfiguration(storageEndpoint);
        FileSystem fs = FileSystem.get(conf);
        if (!fs.exists(lateLogPath)) {
            LOG.warn("Late log file:" + lateLogPath + " not found:");
            return "";
        }

        String[] pathGroups = falconInPaths.split("#");
        String[] inputFeeds = falconInputFeeds.split("#");
        String[] inputFeedStorageTypes = falconInputFeedStorageTypes.split("#");

        Map<String, Long> computedMetrics = new LinkedHashMap<String, Long>();
        Entity entity = EntityUtil.getEntity(message.getEntityType(), message.getEntityName());
        if (EntityUtil.getLateProcess(entity) != null) {
            List<String> lateFeed = new ArrayList<String>();
            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 computedMetric = late.computeStorageMetric(
                            pathGroups[index], inputFeedStorageTypes[index], conf);
                    computedMetrics.put(inputFeeds[index], computedMetric);
                }
            }
        } else {
            LOG.warn("Late process is not configured for entity: "
                    + message.getEntityType() + "(" + message.getEntityName() + ")");
        }

        return late.detectChanges(lateLogPath, computedMetrics, conf);
    }
View Full Code Here

Examples of org.apache.falcon.latedata.LateDataHandler

            String key = line.substring(0, index);
            long size = Long.parseLong(line.substring(index + 1));
            recordedMetrics.put(key, size);
        }

        LateDataHandler lateDataHandler = new LateDataHandler();
        final long metric = lateDataHandler.computeStorageMetric(args[3], args[7], new Configuration());
        Assert.assertEquals(recordedMetrics.get("foo").longValue(), metric);

        final String changes = lateDataHandler.detectChanges(lateDataPath, recordedMetrics, new Configuration());
        Assert.assertEquals("", changes);
    }
View Full Code Here

Examples of org.apache.falcon.latedata.LateDataHandler

            recordedMetrics.put(key, size);
        }

        reinstatePartition();

        LateDataHandler lateDataHandler = new LateDataHandler();
        long metric = lateDataHandler.computeStorageMetric(args[3], args[7], new Configuration());
        Assert.assertFalse(recordedMetrics.get("foo") == metric);

        Map<String, Long> computedMetrics = new LinkedHashMap<String, Long>();
        computedMetrics.put("foo", metric);

        String changes = lateDataHandler.detectChanges(lateDataPath, computedMetrics, new Configuration());
        Assert.assertEquals("foo", changes);
    }
View Full Code Here

Examples of org.apache.falcon.latedata.LateDataHandler

            String key = line.substring(0, index);
            long size = Long.parseLong(line.substring(index + 1));
            recordedMetrics.put(key, size);
        }

        LateDataHandler lateDataHandler = new LateDataHandler();
        final long metric = lateDataHandler.computeStorageMetric(args[3], args[7], new Configuration());
        Assert.assertEquals(recordedMetrics.get("foo").longValue(), metric);

        final String changes = lateDataHandler.detectChanges(lateDataPath, recordedMetrics, new Configuration());
        Assert.assertEquals("", changes);
    }
View Full Code Here

Examples of org.apache.falcon.latedata.LateDataHandler

            recordedMetrics.put(key, size);
        }

        reinstatePartition();

        LateDataHandler lateDataHandler = new LateDataHandler();
        long metric = lateDataHandler.computeStorageMetric(args[3], args[7], new Configuration());
        Assert.assertFalse(recordedMetrics.get("foo") == metric);

        Map<String, Long> computedMetrics = new LinkedHashMap<String, Long>();
        computedMetrics.put("foo", metric);

        String changes = lateDataHandler.detectChanges(lateDataPath, computedMetrics, new Configuration());
        Assert.assertEquals("foo", changes);
    }
View Full Code Here

Examples of org.apache.falcon.latedata.LateDataHandler

                    Integer.toString(message.getRunId()), e.getMessage());
        }
    }

    public String detectLate(LaterunEvent message) throws Exception {
        LateDataHandler late = new LateDataHandler();
        Properties properties = handler.getWfEngine().getWorkflowProperties(
                message.getClusterName(), message.getWfId());
        String falconInputFeeds = properties.getProperty("falconInputFeeds");
        String falconInPaths = properties.getProperty("falconInPaths");
        String falconInputFeedStorageTypes = properties.getProperty("falconInputFeedStorageTypes");
        String logDir = properties.getProperty("logDir");
        String nominalTime = properties.getProperty("nominalTime");
        String srcClusterName = properties.getProperty("srcClusterName");
        Path lateLogPath = handler.getLateLogPath(logDir, nominalTime, srcClusterName);

        final String storageEndpoint = properties.getProperty(AbstractWorkflowEngine.NAME_NODE);
        Configuration conf = LateRerunHandler.getConfiguration(storageEndpoint);
        FileSystem fs = HadoopClientFactory.get().createFileSystem(conf);
        if (!fs.exists(lateLogPath)) {
            LOG.warn("Late log file:" + lateLogPath + " not found:");
            return "";
        }

        String[] pathGroups = falconInPaths.split("#");
        String[] inputFeeds = falconInputFeeds.split("#");
        String[] inputFeedStorageTypes = falconInputFeedStorageTypes.split("#");

        Map<String, Long> computedMetrics = new LinkedHashMap<String, Long>();
        Entity entity = EntityUtil.getEntity(message.getEntityType(), message.getEntityName());
        if (EntityUtil.getLateProcess(entity) != null) {
            List<String> lateFeed = new ArrayList<String>();
            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 computedMetric = late.computeStorageMetric(
                            pathGroups[index], inputFeedStorageTypes[index], conf);
                    computedMetrics.put(inputFeeds[index], computedMetric);
                }
            }
        } else {
            LOG.warn("Late process is not configured for entity: "
                    + message.getEntityType() + "(" + message.getEntityName() + ")");
        }

        return late.detectChanges(lateLogPath, computedMetrics, conf);
    }
View Full Code Here

Examples of org.apache.falcon.latedata.LateDataHandler

        }

    }

    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);
    }
View Full Code Here

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
Copyright © 2018 www.massapi.com. 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.