Package com.netflix.aegisthus.tools

Examples of com.netflix.aegisthus.tools.StorageHelper


    job.setMapOutputKeyClass(LongWritable.class);
    job.setMapOutputValueClass(Text.class);
    job.setMapperClass(Map.class);
    job.setReducerClass(Reduce.class);
    job.setPartitionerClass(Partition.class);
    StorageHelper sh = new StorageHelper(job.getConfiguration());
    LOG.info(String.format("temp location for job: %s", sh.getBaseTempLocation()));

    return job;
  }
View Full Code Here


      return 1;
    }

    Job job = initializeJob();
    String outputDir = cl.getOptionValue(OUTPUT);
    StorageHelper helper = new StorageHelper(job.getConfiguration());
    helper.setFinalPath(outputDir);

    checkOutputDirectory(job, outputDir, cl.hasOption(OPT_OVERWRITE));

    job.getConfiguration().setBoolean(CFG_PREFIX + OPT_PRIAM, cl.hasOption(OPT_PRIAM));
    if (cl.hasOption(OPT_RECURSIVE)) {
View Full Code Here

  public static class Reduce extends Reducer<LongWritable, Text, Text, Text> {

    @Override
    protected void reduce(LongWritable key, Iterable<Text> values, Context ctx) throws IOException,
        InterruptedException {
      StorageHelper helper = new StorageHelper(ctx);
      boolean snappy = ctx.getConfiguration().getBoolean(CFG_PREFIX + OPT_PRIAM, false);
      String base = ctx.getConfiguration().get(CFG_PREFIX + OPT_RECURSIVE);
      if (base != null && !base.endsWith("/")) {
        base = base + "/";
      }
      for (Text file : values) {
        String fileString = cleanS3(file.toString().trim());
        if (base == null) {
          helper.copyToTemp(fileString, snappy);
        } else {
          String prefix = fileString.substring(base.length());
          prefix = prefix.replaceAll("/[^/]+$", "");
          helper.copyToTemp(fileString, prefix, snappy);
        }

      }
    }
View Full Code Here

  }

  @Override
  public void abortJob(JobContext job, State state) throws IOException {
    LOG.info("aborting job");
    StorageHelper sh = new StorageHelper(job.getConfiguration());
    try {
      LOG.info("deleting committed files");
      sh.deleteCommitted();
    } finally {
      LOG.info("deleting temp files");
      sh.deleteBaseTempLocation();
    }
  }
View Full Code Here

  }

  @Override
  public void commitJob(JobContext job) throws IOException {
    LOG.info("committing job");
    StorageHelper sh = new StorageHelper(job.getConfiguration());
    sh.deleteBaseTempLocation();
  }
View Full Code Here

  }

  @Override
  public void commitTask(TaskAttemptContext ctx) throws IOException {
    LOG.info("committing task");
    StorageHelper sh = new StorageHelper(ctx);
    sh.moveTaskOutputToFinal();
  }
View Full Code Here

    return true;
  }

  @Override
  public void setupJob(JobContext job) throws IOException {
    StorageHelper sh = new StorageHelper(job.getConfiguration());
    LOG.info(String.format("temp location for job: %s", sh.getBaseTempLocation()));
  }
View Full Code Here

    LOG.info(String.format("temp location for job: %s", sh.getBaseTempLocation()));
  }

  @Override
  public void setupTask(TaskAttemptContext ctx) throws IOException {
    StorageHelper sh = new StorageHelper(ctx);
    LOG.info(String.format("temp location for task: %s", sh.getBaseTaskAttemptTempLocation()));
  }
View Full Code Here

        ctx.getCounter("aegisthus", "rows_written").increment(1L);
    }

    @Override
    protected void setup(Context context) throws IOException, InterruptedException {
        StorageHelper sh = new StorageHelper(context);
        Path outputDir = new Path(sh.getBaseTaskAttemptTempLocation());
        FileSystem fs = outputDir.getFileSystem(context.getConfiguration());
        String filename = String.format("%s-%s-%05d0%04d-Data.db",
                context.getConfiguration().get("aegisthus.dataset", "keyspace-dataset"), Version.current_version,
                context.getTaskAttemptID().getTaskID().getId(), context.getTaskAttemptID().getId());
        Path outputFile = new Path(outputDir, filename);
View Full Code Here

        }
        TextInputFormat.setInputPaths(job, paths.toArray(new Path[paths.size()]));
        Path temp = new Path("/tmp/" + UUID.randomUUID());
        TextOutputFormat.setOutputPath(job, temp);

        StorageHelper sh = new StorageHelper(job.getConfiguration());
        sh.setFinalPath(cl.getOptionValue(OPT_OUTPUT));
        LOG.info("temp location for job: {}", sh.getBaseTempLocation());

        job.submit();
        System.out.println(job.getJobID());
        System.out.println(job.getTrackingURL());
        boolean success = job.waitForCompletion(true);
View Full Code Here

TOP

Related Classes of com.netflix.aegisthus.tools.StorageHelper

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.