Example usage for org.apache.hadoop.util Tool getConf

List of usage examples for org.apache.hadoop.util Tool getConf

Introduction

In this page you can find the example usage for org.apache.hadoop.util Tool getConf.

Prototype

Configuration getConf();

Source Link

Document

Return the configuration used by this object.

Usage

From source file:com.ebay.erl.mobius.core.MobiusJobRunner.java

License:Apache License

/**
 * submit the <code>tool</code> with specified <code>args</code>.
 *///from w w w  .  j ava2  s .c  om
public static int run(Tool tool, String[] args) throws Exception {
    Configuration conf = tool.getConf() == null ? new Configuration() : tool.getConf();

    LOGGER.info("file.file.impl:" + conf.get("fs.file.impl"));

    GenericOptionsParser gop = new GenericOptionsParser(conf, args);
    conf = gop.getConfiguration();
    String[] remaining = gop.getRemainingArgs();
    TupleRestrictions.configure(conf);

    return MobiusJobRunner.run(conf, tool, remaining);
}

From source file:com.ery.server.util.ToolRunner.java

License:Apache License

/**
 * Runs the <code>Tool</code> with its <code>Configuration</code>.
 * // w w w . ja  v a  2 s  .  c  om
 * Equivalent to <code>run(tool.getConf(), tool, args)</code>.
 * 
 * @param tool
 *            <code>Tool</code> to run.
 * @param args
 *            command-line arguments to the tool.
 * @return exit code of the {@link Tool#run(String[])} method.
 */
public static int run(Tool tool, String[] args) throws Exception {
    return run(tool.getConf(), tool, args);
}

From source file:eu.scape_project.tb.wc.archd.mapreduce.FileCharacterisation.java

License:Apache License

public static void main(String[] args) throws Exception {
    System.out.println(name);//from w  ww .j a  v a2s.  co m
    long startTime = System.currentTimeMillis();

    Tool tool = new FileCharacterisation();
    tool.setConf(new Configuration(true));
    tool.getConf().set("mapreduce.job.user.classpath.first", "true");
    tool.getConf().set("mapreduce.user.classpath.first", "true");

    for (int i = 0; i < args.length; i++) {
        System.out.println("Arg" + i + ": " + args[i]);
    }

    int res = ToolRunner.run(tool.getConf(), tool, args);

    long elapsedTime = System.currentTimeMillis() - startTime;
    System.out.println("Processing time (sec): " + elapsedTime / 1000F);

    System.exit(res);
}

From source file:eu.scape_project.tb.wc.archd.mapreduce.TikaCharacterisation.java

License:Apache License

public static void main(String[] args) throws Exception {
    System.out.println(name);//from   w  ww.j a  va  2  s . c  om
    long startTime = System.currentTimeMillis();

    Tool tool = new TikaCharacterisation();
    tool.setConf(new Configuration(true));
    tool.getConf().addResource("jobConfig.xml");

    for (int i = 0; i < args.length; i++) {
        System.out.println("Arg" + i + ": " + args[i]);
    }

    int res = ToolRunner.run(tool.getConf(), tool, args);

    long elapsedTime = System.currentTimeMillis() - startTime;
    System.out.println("Processing time (sec): " + elapsedTime / 1000F);

    System.exit(res);
}

From source file:org.apache.kylin.engine.mr.MRUtil.java

License:Apache License

public static int runMRJob(Tool tool, String[] args) throws Exception {
    Configuration conf = tool.getConf();
    if (conf == null) {
        conf = new Configuration();
    }/*from   www  . j  ava2  s  . co  m*/

    GenericOptionsParser parser = getParser(conf, args);
    //set the configuration back, so that Tool can configure itself
    tool.setConf(conf);

    //get the args w/o generic hadoop args
    String[] toolArgs = parser.getRemainingArgs();
    return tool.run(toolArgs);
}