我正在寻找斯坦福大学CS246 2014硬件解决方案中最受欢迎的解决方案。

我一直遇到错误“错误:java.lang.RuntimeException:PipeMapRed.waitOutputThreads():子进程失败,代码为1”

我的映射器的python代码是

{#!/usr/bin/python

import sys

ID = None
fcount = 0
count = 0

for line in sys.stdin:
    line = line.strip()

    words = line.split("        ")
    ID,friends = words
    fcount = len(friends.split(","))
    #count = fcount * -1
#for i in friends:
#               if i != ','

#               fcount +=1

    print "%d\t%s" %(fcount,ID)

}

我的 reducer 代码是

{
#!/usr/bin/python

import sys

ID = None
fcount = 0
count = 0

for line in sys.stdin:
    line = line.strip()

    words = line.split("        ")
    ID,friends = words
    fcount = len(friends.split(","))
    #count = fcount * -1
#for i in friends:
#               if i != ','

#               fcount +=1

    print "%d\t%s" %(fcount,ID)

}

任何帮助,将不胜感激

最佳答案

终于明白了。发生错误是由于python的两个不同版本。我的系统上安装了python 3,hadoop系统上安装了python 2。

10-06 06:40