Package org.apache.hadoop.chukwa

Examples of org.apache.hadoop.chukwa.ChukwaArchiveKey


  private static void dumpFile(Path p, Configuration conf,
      FileSystem fs) throws IOException {
    SequenceFile.Reader r = new SequenceFile.Reader(fs, p, conf);

    ChukwaArchiveKey key = new ChukwaArchiveKey();
    ChunkImpl chunk = ChunkImpl.getBlankChunk();
    try {
      while (r.next(key, chunk)) {
       
        String entryKey = chunk.getSource() +":"+chunk.getDataType() +":" +
        chunk.getApplication();
       
        Integer oldC = counts.get(entryKey);
        if(oldC != null)
          counts.put(entryKey, oldC + 1);
        else
          counts.put(entryKey, new Integer(1));
       
        if(!summarize) {
          System.out.println("\nTimePartition: " + key.getTimePartition());
          System.out.println("DataType: " + key.getDataType());
          System.out.println("StreamName: " + key.getStreamName());
          System.out.println("SeqId: " + key.getSeqId());
          System.out.println("\t\t =============== ");
 
          System.out.println("Cluster : " + chunk.getTags());
          System.out.println("DataType : " + chunk.getDataType());
          System.out.println("Source : " + chunk.getSource());
View Full Code Here


      log.info("Collector not ready");
      throw new WriterException("Collector not ready");
    }

    if (chunks != null) {
      ChukwaArchiveKey archiveKey = new ChukwaArchiveKey();
     
      if (System.currentTimeMillis() >= nextTimePeriodComputation) {
        computeTimePeriod();
      }
      try {
        lock.acquire();
        for (Chunk chunk : chunks) {
          archiveKey.setTimePartition(timePeriod);
          archiveKey.setDataType(chunk.getDataType());
          archiveKey.setStreamName(chunk.getTags() + "/" + chunk.getSource()
              + "/" + chunk.getStreamName());
          archiveKey.setSeqId(chunk.getSeqID());

          if (chunk != null) {
            // compute size for stats
            dataSize += chunk.getData().length;
            bytesThisRotate += chunk.getData().length;
View Full Code Here

         ChukwaArchiveKey.class, ChunkImpl.class,
         SequenceFile.CompressionType.NONE, null);
     RandSeqFileWriter rw = new RandSeqFileWriter();
     for (int i = 0; i < chunks; ++i) {
       ChunkImpl chunk = rw.getARandomChunk();
       ChukwaArchiveKey archiveKey = new ChukwaArchiveKey();

       calendar.set(Calendar.YEAR, 2008);
       calendar.set(Calendar.MONTH, Calendar.MAY);
       calendar.set(Calendar.DAY_OF_MONTH, 29);
       calendar.set(Calendar.HOUR, 10);
       calendar.set(Calendar.MINUTE, 0);
       calendar.set(Calendar.SECOND, 0);
       calendar.set(Calendar.MILLISECOND, 0);
       archiveKey.setTimePartition(calendar.getTimeInMillis());
       archiveKey.setDataType(chunk.getDataType());
       archiveKey.setStreamName(chunk.getStreamName());
       archiveKey.setSeqId(chunk.getSeqID());
       seqFileWriter.append(archiveKey, chunk);
     }
     seqFileWriter.close();
     out.close();
   }
View Full Code Here

    SequenceFile.Writer seqFileWriter = SequenceFile.createWriter(conf, out,
        ChukwaArchiveKey.class, ChunkImpl.class,
        SequenceFile.CompressionType.NONE, null);
    for(int i=0; i < chunks; ++i) {
      ChunkImpl chunk = getARandomChunk();
      ChukwaArchiveKey archiveKey = new ChukwaArchiveKey();
      // FIXME compute this once an hour
      calendar.setTimeInMillis(System.currentTimeMillis());
      calendar.set(Calendar.MINUTE, 0);
      calendar.set(Calendar.SECOND, 0);
      calendar.set(Calendar.MILLISECOND, 0);
      archiveKey.setTimePartition(calendar.getTimeInMillis());
      archiveKey.setDataType(chunk.getDataType());
      archiveKey.setStreamName(chunk.getStreamName());
      archiveKey.setSeqId(chunk.getSeqID());
      seqFileWriter.append(archiveKey, chunk);
    }
    seqFileWriter.close();
    out.close();
  }
View Full Code Here

    if (chunk != null)
    {
      try
      {
        assert chunk instanceof ChunkImpl : "bad input type";
        ChukwaArchiveKey archiveKey = new ChukwaArchiveKey();

        // FIXME compute this once an hour
        synchronized (calendar)
        {
          calendar.setTimeInMillis(System.currentTimeMillis());
          calendar.set(Calendar.MINUTE, 0);
          calendar.set(Calendar.SECOND, 0);
          calendar.set(Calendar.MILLISECOND, 0);

          archiveKey.setTimePartition(calendar.getTimeInMillis());
        }

        archiveKey.setDataType(chunk.getDataType());
        archiveKey.setStreamName(chunk.getStreamName());
        archiveKey.setSeqId(chunk.getSeqID());

        seqFileWriter.append(archiveKey, chunk);

        dataSize += chunk.getData().length;
        // currentOutput.sync(); //force file out to stable storage on
View Full Code Here

       fs= FileSystem.get(new URI(fsURL), conf);
    SequenceFile.Reader r= new SequenceFile.Reader(fs, new Path(fname), conf);
    System.out.println("key class name is " + r.getKeyClassName());
    System.out.println("value class name is " + r.getValueClassName());
   
    ChukwaArchiveKey key = new ChukwaArchiveKey();
    ChunkImpl evt =  ChunkImpl.getBlankChunk();
    int events = 0;
    while(r.next(key, evt) &&  (events < 5))
    {
      if(!Writable.class.isAssignableFrom(key.getClass()))
        System.out.println("warning: keys aren't writable");
     
      if(!Writable.class.isAssignableFrom(evt.getClass()))
        System.out.println("warning: values aren't writable");
     
View Full Code Here

    Tracer t = Tracer.startNewTracer("honu.server." + group +".addToList");
    long now = System.currentTimeMillis();
    if (chunks != null) {
      try {
        chunksWrittenThisRotate = true;
        ChukwaArchiveKey archiveKey = new ChukwaArchiveKey();

        for (Chunk chunk : chunks) {
          archiveKey.setTimePartition(timePeriod);
          archiveKey.setDataType(chunk.getDataType());
          archiveKey.setStreamName(chunk.getTags() + "/" + chunk.getSource()
              + "/" + chunk.getStreamName());
          archiveKey.setSeqId(chunk.getSeqID());

          if (chunk != null) {
            seqFileWriter.append(archiveKey, chunk);
            // compute size for stats
            dataSize += chunk.getData().length;
View Full Code Here

    System.out.println(new java.util.Date() + ", CmdLineConverter [" + dataType + "] [" +  newOutputPath + "], Total lineCount: " + lineCount);
    System.exit(0);
  }
 
  public static void append(SequenceFile.Writer  seqFileWriter, Chunk chunk) throws Throwable {
    ChukwaArchiveKey archiveKey = new ChukwaArchiveKey();
    archiveKey.setTimePartition(System.currentTimeMillis());
    archiveKey.setDataType(chunk.getDataType());
    archiveKey.setStreamName("CmdLineConverter");
    archiveKey.setSeqId(chunk.getSeqID());
    seqFileWriter.append(archiveKey, chunk);
  }
View Full Code Here

        if(!fstatus.getPath().getName().endsWith(".done"))
          continue;
       
        SequenceFile.Reader reader = new SequenceFile.Reader(localfs, fstatus.getPath(), conf);

        ChukwaArchiveKey key = new ChukwaArchiveKey();
        ChunkImpl chunk = ChunkImpl.getBlankChunk();

        while (reader.next(key, chunk)) {
         bytes.add(new ByteRange(chunk));
        }
View Full Code Here

  @Override
  public void add(List<Chunk> chunks) throws WriterException {
    if (chunks != null) {
      try {
        chunksWrittenThisRotate = true;
        ChukwaArchiveKey archiveKey = new ChukwaArchiveKey();

        // FIXME compute this once an hour
        //
        synchronized (calendar) {
          calendar.setTimeInMillis(System.currentTimeMillis());
          calendar.set(Calendar.MINUTE, 0);
          calendar.set(Calendar.SECOND, 0);
          calendar.set(Calendar.MILLISECOND, 0);

          archiveKey.setTimePartition(calendar.getTimeInMillis());
        }

        ClientAck localClientAck = null;
        synchronized (lock) {
          localClientAck = SeqFileWriter.clientAck;
          for (Chunk chunk : chunks) {
            archiveKey.setDataType(chunk.getDataType());
            archiveKey.setStreamName(chunk.getTags() + "/" + chunk.getSource()
                + "/" + chunk.getStreamName());
            archiveKey.setSeqId(chunk.getSeqID());

            if (chunk != null) {
              seqFileWriter.append(archiveKey, chunk);
              // compute size for stats
              dataSize += chunk.getData().length;
View Full Code Here

TOP

Related Classes of org.apache.hadoop.chukwa.ChukwaArchiveKey

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.