python - 当使用echo的代码完美工作时,Hadoop python作业给我一个错误

标签 python hadoop jar mapreduce

我正在寻找斯坦福大学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。

关于python - 当使用echo的代码完美工作时,Hadoop python作业给我一个错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36904581/

相关文章:

Python正则表达式匹配可选的双引号字符串

python - 这个 boost.python 程序有什么错误?

python - Flask RESTful 销毁用户 token

python - 返回具有给定字典值的键的字典,反之亦然

java - Hadoop 找不到映射器类

hadoop - 初始化 Metron Grok 解析器时出错

java - 如何替换 jar 文件中某个目录中的某些文件?

java - 如何将Jar转为exe或msi包进行远程部署?

hadoop - 在 pig 中有条件地分组记录

java - 如何在 netbeans 中创建 .exe 文件?