python - 使用 boto 设置 hadoop 参数?

标签 python boto elastic-map-reduce

我正在尝试在我的 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 参数?

最佳答案

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

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

关于python - 使用 boto 设置 hadoop 参数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12071436/

相关文章:

python - 如何将列表中的元素搜索到字符串中并提取匹配项旁边的关键字

amazon-dynamodb - DynamoDB 表正在创建,但无法插入新项目

HANDLE 的 Python ctypes

python - 我怎样才能用 Jinja2 做这个循环?

primary-key - 没有主键知识的亚马逊 dynamodb 查询

python-2.7 - IO错误 : No such file or directory:

hadoop - 写入 1 亿个文件到 s3

hadoop - 估算并行计算的计算成本

amazon-web-services - 有人使用 Amazon Elastic Map Reduce 的 ruby​​ 客户端创建了具有多个输入的作业吗?

python - 使用 Open CV Python 将 alpha channel 添加到单色图像