Package org.apache.hadoop.chukwa.extraction.demux.processor.mapper

Examples of org.apache.hadoop.chukwa.extraction.demux.processor.mapper.MapProcessor


    File inputFile = new File( datadir+ File.separator + "ClientTrace.log");
    Path outputFile = new Path(outputDir + "/" + this.getClass().getName() + "/ClientTrace.evt");
    String clusterName = "testClusterName";
    String dataType = "testDataType";
    String streamName = "testStreamName";
    MapProcessor processor = new TsProcessor();

    //create the sequence file
    CreateRecordFile.makeTestSequenceFile(inputFile, outputFile, clusterName,
                                          dataType, streamName, processor);
    //read the output file
View Full Code Here


        if (!processorClass.equalsIgnoreCase("Drop")) {
          reporter.incrCounter("DemuxMapInput", "total chunks", 1);
          reporter.incrCounter("DemuxMapInput",
              chunk.getDataType() + " chunks", 1);

          MapProcessor processor = MapProcessorFactory
              .getProcessor(processorClass);
          processor.process(key, chunk, chukwaOutputCollector, reporter);
          if (log.isDebugEnabled()) {
            duration = System.currentTimeMillis() - duration;
            log.debug("Demux:Map dataType:" + chunk.getDataType()
                + " duration:" + duration + " processor:" + processorClass
                + " recordCount:" + chunk.getRecordOffsets().length);
View Full Code Here

     File inputFile = new File(args[0]);
     Path outputFile = new Path(args[1]);
     String clusterName = "testClusterName";
     String dataType = "testDataType";
     String streamName = "testStreamName";              
     MapProcessor processor = new TsProcessor();
     Path confFile = null;

     if (args.length > 2) clusterName = args[2];
     if (args.length > 3) dataType = args[3];
     if (args.length > 4) streamName = args[4];

     if (args.length > 5) {
       Class clazz = null;
       try {
         clazz = Class.forName(args[5]);
       }
       catch (ClassNotFoundException e) {
         try {
           clazz = Class.forName(
                 "org.apache.hadoop.chukwa.extraction.demux.processor.mapper." + args[5]);
         }
         catch (Exception e2) {
           throw e;
         }
       }
       processor = (MapProcessor)clazz.newInstance();
     }

     if (args.length > 6) {
       confFile = new Path(args[6]);
       Demux.jobConf = new JobConf(confFile);
     }

     System.out.println("Creating sequence file using the following input:");
     System.out.println("inputFile  : " + inputFile);
     System.out.println("outputFile : " + outputFile);
     System.out.println("clusterName: " + clusterName);
     System.out.println("dataType   : " + dataType);
     System.out.println("streamName : " + streamName);
     System.out.println("processor  : " + processor.getClass().getName());
     System.out.println("confFile   : " + confFile);

     makeTestSequenceFile(inputFile, outputFile, clusterName, dataType, streamName, processor);

     System.out.println("Done");
View Full Code Here

    try {
      for(Chunk chunk : chunks) {
        String processorClass = conf.get(chunk.getDataType(),
                defaultProcessor);
        synchronized (this) {
          MapProcessor processor = MapProcessorFactory.getProcessor(processorClass);
          try {
            Table table = null;
            if(processor.getClass().isAnnotationPresent(Table.class)) {
              table = processor.getClass().getAnnotation(Table.class);
            } else if(processor.getClass().isAnnotationPresent(Tables.class)) {
              Tables tables = processor.getClass().getAnnotation(Tables.class);
              for(Table t : tables.annotations()) {
                table = t;
              }
            }
            if(table!=null) {
              HTableInterface hbase = pool.getTable(table.name().getBytes())
              processor.process(new ChukwaArchiveKey(), chunk, output, reporter);
              hbase.put(output.getKeyValues());
              pool.putTable(hbase);
            }
          } catch (Exception e) {
            log.warn(output.getKeyValues());
View Full Code Here

        if (!processorClass.equalsIgnoreCase("Drop")) {
          reporter.incrCounter("DemuxMapInput", "total chunks", 1);
          reporter.incrCounter("DemuxMapInput",
              chunk.getDataType() + " chunks", 1);

          MapProcessor processor = MapProcessorFactory
              .getProcessor(processorClass);
          processor.process(key, chunk, chukwaOutputCollector, reporter);
          if (log.isDebugEnabled()) {
            duration = System.currentTimeMillis() - duration;
            log.debug("Demux:Map dataType:" + chunk.getDataType()
                + " duration:" + duration + " processor:" + processorClass
                + " recordCount:" + chunk.getRecordOffsets().length);
View Full Code Here

        if (!processorClass.equalsIgnoreCase("Drop")) {
          reporter.incrCounter("DemuxMapInput", "total chunks", 1);
          reporter.incrCounter("DemuxMapInput",
              chunk.getDataType() + " chunks", 1);

          MapProcessor processor = MapProcessorFactory
              .getProcessor(processorClass);
          processor.process(key, chunk, chukwaOutputCollector, reporter);
          if (log.isDebugEnabled()) {
            duration = System.currentTimeMillis() - duration;
            log.debug("Demux:Map dataType:" + chunk.getDataType()
                + " duration:" + duration + " processor:" + processorClass
                + " recordCount:" + chunk.getRecordOffsets().length);
View Full Code Here

        if (!processorClass.equalsIgnoreCase("Drop")) {
          reporter.incrCounter("DemuxMapInput", "total chunks", 1);
          reporter.incrCounter("DemuxMapInput",
                  chunk.getDataType() + " chunks", 1);

          MapProcessor processor = MapProcessorFactory
                  .getProcessor(processorClass);
          processor.process(key, chunk, chukwaOutputCollector, reporter);
          if (log.isDebugEnabled()) {
            duration = System.currentTimeMillis() - duration;
            log.debug("Demux:Map dataType:" + chunk.getDataType()
                    + " duration:" + duration + " processor:" + processorClass
                    + " recordCount:" + chunk.getRecordOffsets().length);
View Full Code Here

          try {
            Table table = findHBaseTable(chunk.getDataType());

            if(table!=null) {
              HTableInterface hbase = pool.getTable(table.name().getBytes());
              MapProcessor processor = getProcessor(chunk.getDataType());
              processor.process(new ChukwaArchiveKey(), chunk, output, reporter);

              hbase.put(output.getKeyValues());
              pool.putTable(hbase);
            }
          } catch (Exception e) {
View Full Code Here

    }
    return rv;
  }

  public Table findHBaseTable(String dataType) throws UnknownRecordTypeException {
    MapProcessor processor = getProcessor(dataType);

    Table table = null;
    if(processor.getClass().isAnnotationPresent(Table.class)) {
      return processor.getClass().getAnnotation(Table.class);
    } else if(processor.getClass().isAnnotationPresent(Tables.class)) {
      Tables tables = processor.getClass().getAnnotation(Tables.class);
      for(Table t : tables.annotations()) {
        table = t;
      }
    }
View Full Code Here

     File inputFile = new File(args[0]);
     Path outputFile = new Path(args[1]);
     String clusterName = "testClusterName";
     String dataType = "testDataType";
     String streamName = "testStreamName";              
     MapProcessor processor = new TsProcessor();

     if (args.length > 2) clusterName = args[2];
     if (args.length > 3) dataType = args[3];
     if (args.length > 4) streamName = args[4];

     if (args.length > 5) {
       Class clazz = Class.forName(args[5]);
       processor = (MapProcessor)clazz.newInstance();
     }

     System.out.println("Creating sequence file using the following input:");
     System.out.println("inputFile  : " + inputFile);
     System.out.println("outputFile : " + outputFile);
     System.out.println("clusterName: " + clusterName);
     System.out.println("dataType   : " + dataType);
     System.out.println("streamName : " + streamName);
     System.out.println("processor  : " + processor.getClass().getName());

     makeTestSequenceFile(inputFile, outputFile, clusterName, dataType, streamName, processor);

     System.out.println("Done");
   }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.chukwa.extraction.demux.processor.mapper.MapProcessor

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.