sigizmund.com
More Hadoop Mysteries – order of initialisation
By sigizmund On November 6, 2009 · 41Leave a Commenthttp%3A%2F%2Fsigizmund.com%2Fmore-hadoop-mysteries-order-of-initialisation%2FMore+Hadoop+Mysteries+-+order+of+initialisation2009-11-06+14%3A46%3A00sigizmundhttp%3A%2F%2Fsigizmund.wordpress.com%2F2009%2F11%2F06%2Fmore-hadoop-mysteries-order-of-initialisation
Hey out there! Still not tired of my Hadoop experiments? Not yet? That’s another one for you!
What’d you think the difference is between two snippets of code? Say, this:
SomeCodeWhichChangesConfig.initialise(getConf()); Job job = new Job(conf, "MyHadoopJob"); // ... setting the job details if (!job.waitForCompletion(true)) { System.err.println("FAILED, cannot continue"); }
… and this:
Job job = new Job(conf, "MyHadoopJob"); // ... setting the job details SomeCodeWhichChangesConfig.initialise(getConf()); if (!job.waitForCompletion(true)) { System.err.println("FAILED, cannot continue"); }
No difference, you say? Not quite right, sir: the difference is that whatever you do to conf after creating a job will have no further effect. That is, Job constructor apparently copies all the data and doesn’t link your copy of Configuration object with it’s copy. Brilliant, no?
(and I spent a couple of hours trying to understand why distributed cache works properly in one app and doesn’t work at all in another). So you know now. Be warned.
-
Categories
-
Calendar
February 2012 M T W T F S S « Jun 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 -
Meta




