2012-08-22 30 views
8

我試圖在我的Amazon Elastic MapReduce作業上啓用錯誤輸入跳過。我下面在這裏描述的奇妙配方:用boto設置hadoop參數?

http://devblog.factual.com/practical-hadoop-streaming-dealing-with-brittle-code

上面的鏈接說,我需要以某種方式設置的EMR任務以下配置參數:

mapred.skip.mode.enabled=true 
mapred.skip.map.max.skip.records=1 
mapred.skip.attempts.to.start.skipping=2 
mapred.map.tasks=1000 
mapred.map.max.attempts=10 

如何設置這些(和其他)使用博託在JobFlow上的mapred.XXX參數?

回答

14

多小時的奮力,讀碼和實驗後,這裏就是答案:

您需要添加一個新的BootstrapAction,就像這樣:

params = ['-s','mapred.skip.mode.enabled=true', 
      '-s', 'mapred.skip.map.max.skip.records=1', 
      '-s', 'mapred.skip.attempts.to.start.skipping=2', 
      '-s', 'mapred.map.max.attempts=5', 
      '-s', 'mapred.task.timeout=100000'] 
config_bootstrapper = BootstrapAction('Enable skip mode', 's3://elasticmapreduce/bootstrap-actions/configure-hadoop', params) 

conn = EmrConnection(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY) 
step = StreamingStep(name='My Step', ...) 
conn.run_jobflow(..., bootstrap_actions=[config_bootstrapper], steps=[step], ...) 

當然,如果你有更多的除了一個引導程序操作,您應該將其添加到bootstrap_actions數組中。

+0

謝謝!這對我有效。當我用['-D','...']爲同一組值指定相同的參數並使用「step」而不是bootstrap時,它有時會起作用,但添加此引導程序步驟似乎使此子彈 - 證明。 – Suman