使用Boto设置hadoop参数?

发布于 2021-01-29 16:04:45

我正在尝试在我的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上设置这些(和其他)mapred.XXX参数?

关注者
0
被浏览
41
1 个回答
  • 面试哥
    面试哥 2021-01-29
    为面试而生,有面试问题,就找面试哥。

    经过许多小时的努力,阅读代码和实验,得出的答案是:

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



知识点
面圈网VIP题库

面圈网VIP题库全新上线,海量真题题库资源。 90大类考试,超10万份考试真题开放下载啦

去下载看看