2012-08-22 32 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