hadoop-common-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From 于凤东 <fengdon...@gmail.com>
Subject Who can give me an example to tell me how to use JobControl? Thanks
Date Wed, 04 Nov 2009 10:43:52 GMT
my Code sinpper: but it doesn't work;

public class TestMain {

    /**
     * @param args
     */
    public static void main(String[] args) throws Exception{
        JobControl jc = new JobControl("JC");//

        JobConf conf = new JobConf(TestMain.class);
        conf.setJobName("Tester1");

        conf.setInputFormat(TextInputFormat.class);
        conf.setOutputFormat(TextOutputFormat.class);

        TextInputFormat.setInputPaths(conf, new Path("test"));
        TextOutputFormat.setOutputPath(conf, new Path("out"));

        conf.setOutputKeyClass(Text.class);
        conf.setOutputValueClass(NullWritable.class);
        conf.setMapperClass(Mapper1.class);//

        conf.setNumReduceTasks(0);//


        JobConf conf2 = new JobConf(AnotherMain.class);
        conf2.setJobName("Tester2");

        conf2.setInputFormat(TextInputFormat.class);
        conf2.setOutputFormat(TextOutputFormat.class);

        TextInputFormat.setInputPaths(conf2, new Path("out"));
        TextOutputFormat.setOutputPath(conf2, new Path("out2"));

        conf2.setOutputKeyClass(Text.class);
        conf2.setOutputValueClass(NullWritable.class);
        conf2.setMapperClass(Mapper2.class);
        conf2.setNumReduceTasks(0);

        Job j1 = new Job(conf);
        Job j2 = new Job(conf2);
        j1.addDependingJob(j2);

        jc.addJob(j1);

        jc.run()
}
}

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message