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

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

Introduction

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

Prototype

public StreamJob() 

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);/*w  w  w. j a v a 2 s.  com*/
    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);
}