使用boto设置hadoop参数



我正试图在我的Amazon Elastic MapReduce作业上启用错误输入跳过。我正在遵循这里描述的绝妙配方:

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

如何设置这些(和其他)映射。使用Boto的JobFlow上的XXX个参数?

经过数小时的挣扎、阅读代码和实验,答案如下:

你需要添加一个新的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数组中。

最新更新