gpt4 book ai didi

amazon-web-services - 错误:java.lang.RuntimeException:PipeMapRed.waitOutputThreads():子进程在AWS-EMR上失败,代码为1,但在本地计算机上工作

转载 作者:行者123 更新时间:2023-12-02 20:15:52 27 4
gpt4 key购买 nike

我正在尝试运行一个简单的mapreduce代码,仅使用mapper.py进行读取,获取mapper.py的输出,并通过reducer.py进行读取。这段代码在本地计算机上有效,但是当我在aws-emr上尝试时,出现以下错误-

Error: java.lang.RuntimeException: PipeMapRed.waitOutputThreads(): subprocess failed with code 1
这是input.txt,mapper.py和reducer.py
input.txt
scott,haris
jenifer,smith
ted,brandy
amanda,woods
bob,wilton
damn,halloween
映射器
#!/usr/bin/env python

import sys

for line in sys.stdin:
x = line.strip()
first,last = x.split(",")
print '%s\t%s' % (first, last)
reducer.py
#!/usr/bin/env python
import sys

for line in sys.stdin:
x = line.strip()
key, value = x.split('\t')
print '%s\t%s' % (key, value)
我正在使用以下命令:
hadoop jar /usr/lib/hadoop/hadoop-streaming.jar -files s3://test/mapper.py,s3://test/reducer.py -mapper "python mapper.py" -reducer "python reducer.py" -input s3://test/input.txt -output s3://test/output

最佳答案

似乎您在使用python reducer / mapper脚本时遇到问题,可以检查以下两件事
1.您的MapperReducer脚本是否可执行(确保您使用指向正确的env,如try #!/usr/bin/python )并具有正确的权限?
2.您的Python程序是正确的,例如,如果服务器运行的是python3,则需要带括号括住print()或脚本的任何其他问题。
尝试使用bash在emr中正常执行python,看看它是否有效

关于amazon-web-services - 错误:java.lang.RuntimeException:PipeMapRed.waitOutputThreads():子进程在AWS-EMR上失败,代码为1,但在本地计算机上工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63872693/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com