Example usage for org.apache.hadoop.streaming StreamJob setConf

List of usage examples for org.apache.hadoop.streaming StreamJob setConf

Introduction

In this page you can find the example usage for org.apache.hadoop.streaming StreamJob setConf.

Prototype

@Override
    public void setConf(Configuration conf) 

Source Link

Usage

From source file:org.springframework.data.hadoop.mapreduce.StreamJobFactoryBean.java

License:Apache License

private Configuration createStreamJob(Configuration cfg, String[] args) {
    // ugly reflection to add an extra method to #createJob
    StreamJob job = new StreamJob();
    job.setConf(cfg);
    Field argv = ReflectionUtils.findField(job.getClass(), "argv_");
    // job.argv_ = args
    ReflectionUtils.makeAccessible(argv);
    ReflectionUtils.setField(argv, job, args);

    // job.init();
    invokeMethod(job, "init");
    // job.preProcessArgs();
    invokeMethod(job, "preProcessArgs");
    // job.parseArgv();
    invokeMethod(job, "parseArgv");
    // job.postProcessArgs();
    invokeMethod(job, "postProcessArgs");
    // job.setJobConf();
    invokeMethod(job, "setJobConf");
    // return job.jobConf_;
    Field jobConf = ReflectionUtils.findField(job.getClass(), "jobConf_");
    ReflectionUtils.makeAccessible(jobConf);
    return (Configuration) ReflectionUtils.getField(jobConf, job);
}