예제 #1
0
  public GeneratorTask(Configuration conf, ParameterSet parameterSet, List<Long> group, String id) {
    this.parameterSet = parameterSet;
    this.list = group;
    this.id = id;
    generator = new TextRecordGenerator();
    if (generator == null) {
      LOG.error("Cannot initialize the generator " + TextRecordGenerator.class.getName());
      System.exit(1);
    }

    LOG.debug("InstanceDoc: " + parameterSet.instanceDoc);
    generator.loadGenerator(parameterSet.instanceDoc);
    dateTime = new DateTime();
    formatter = DateTimeFormat.forPattern("yyyyMMdd-hhmmss");

    conf.set("dfs.replication", "" + parameterSet.replicaNum);
    if (parameterSet.codec != null) {
      conf.set("generator.codec", parameterSet.codec);
    }
    sink = new FileSystemSink(conf);
    sink.setOutputFolder(parameterSet.outputDir);

    computeTotal();
  }