Examples of ShardWriter


Examples of com.alimama.mdrill.index.utils.ShardWriter

    String uuid=java.util.UUID.randomUUID().toString();
    indexHdfsPath = new Path(outputdir, part_xxxxx).toString();
    tmpath = new Path(outputdir + "/_tmpindex", part_xxxxx + "_"+uuid).toString();
    tmpathzip = new Path(outputdir + "/_tmpindex", part_xxxxx + "_zip_"+ uuid).toString();
   
    ShardWriter shardWriter = new ShardWriter(fs, tmpath, conf);
    return shardWriter;
  }
View Full Code Here

Examples of com.alimama.mdrill.index.utils.ShardWriter

    indexHdfsPath = new Path(outputdir, part_xxxxx).toString();

    tmpath = new Path(outputdir + "/_tmpindex", part_xxxxx + "_" + java.util.UUID.randomUUID().toString()).toString();
    localtmpath = new Path("./_tmpindex", part_xxxxx + "_" + java.util.UUID.randomUUID().toString()).toString();
   
    ShardWriter shardWriter = new ShardWriter(lfs, localtmpath, conf);
    return shardWriter;
  }
View Full Code Here

Examples of org.apache.hadoop.contrib.index.lucene.ShardWriter

    LOG.info("Construct a shard writer for " + key);
    FileSystem fs = FileSystem.get(iconf.getConfiguration());
    String temp =
        mapredTempDir + Path.SEPARATOR + "shard_" + System.currentTimeMillis();
    final ShardWriter writer = new ShardWriter(fs, key, temp, iconf);

    // update the shard
    while (values.hasNext()) {
      IntermediateForm form = values.next();
      writer.process(form);
      reporter.progress();
    }

    // close the shard
    final Reporter fReporter = reporter;
    new Closeable() {
      boolean closed = false;

      public void close() throws IOException {
        // spawn a thread to give progress heartbeats
        Thread prog = new Thread() {
          public void run() {
            while (!closed) {
              try {
                fReporter.setStatus("closing");
                Thread.sleep(1000);
              } catch (InterruptedException e) {
                continue;
              } catch (Throwable e) {
                return;
              }
            }
          }
        };

        try {
          prog.start();

          if (writer != null) {
            writer.close();
          }
        } finally {
          closed = true;
        }
      }
View Full Code Here

Examples of org.apache.hadoop.contrib.index.lucene.ShardWriter

    LOG.info("Construct a shard writer for " + key);
    FileSystem fs = FileSystem.get(iconf.getConfiguration());
    String temp =
        mapredTempDir + Path.SEPARATOR + "shard_" + System.currentTimeMillis();
    final ShardWriter writer = new ShardWriter(fs, key, temp, iconf);

    // update the shard
    while (values.hasNext()) {
      IntermediateForm form = values.next();
      writer.process(form);
      reporter.progress();
    }

    // close the shard
    final Reporter fReporter = reporter;
    new Closeable() {
      volatile boolean closed = false;

      public void close() throws IOException {
        // spawn a thread to give progress heartbeats
        Thread prog = new Thread() {
          public void run() {
            while (!closed) {
              try {
                fReporter.setStatus("closing");
                Thread.sleep(1000);
              } catch (InterruptedException e) {
                continue;
              } catch (Throwable e) {
                return;
              }
            }
          }
        };

        try {
          prog.start();

          if (writer != null) {
            writer.close();
          }
        } finally {
          closed = true;
        }
      }
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.