如何解决java.lang.RuntimeException:PipeMapRed.waitOutputThreads():子进程失败,代码为2?

问题描述 投票:4回答:4

我试图在Hadoop环境中执行NLTK。以下是我用于执行的命令。

bin/hadoop jar $HADOOP_HOME/contrib/streaming/hadoop-streaming-1.0.4.jar -input /user/nltk/input/ -output /user/nltk/output1/ -file /home/hduser/softwares/NLTK/unsupervised_sentiment-master.zip -mapper /home/hduser/softwares/NLTK/unsupervised_sentiment-master/sentiment.py

unsupervised_sentiment-master.zip ---包含sentiment.py所需的所有相关文件

我正进入(状态

java.lang.RuntimeException: PipeMapRed.waitOutputThreads(): subprocess failed with code 2
    at org.apache.hadoop.streaming.PipeMapRed.waitOutputThreads(PipeMapRed.java:362)
    at org.apache.hadoop.streaming.PipeMapRed.mapRedFinished(PipeMapRed.java:576)
    at org.apache.hadoop.streaming.PipeMapper.close(PipeMapper.java:135)
    at org.apache.hadoop.mapred.MapRunner.run(MapRunner.java:57)
    at org.apache.hadoop.streaming.PipeMapRunner.run(PipeMapRunner.java:36)
    at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:436)
    at org.apache.hadoop.mapred.MapTask.run(MapTask.java:372)
    at org.apache.hadoop.mapred.Child$4.run(Child.java:255)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:415)
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1121)
    at org.apache.hadoop.mapred.Child.main(Child.java:249)

任何帮助将不胜感激!!!

hadoop nltk hadoop-streaming
4个回答
8
投票

你能发布python文件吗?我的猜测是,您需要将#!/ usr / bin / python添加到py文件的顶部。当我使用python进行流式传输时就是这种情况。

最好的,哈里


2
投票

将下面的行添加到python脚本的顶部使代码适合我。

#!的/ usr / bin中/蟒蛇


0
投票

我不能确切地说出你的错误是什么,但我的是我的python脚本中有一个未解决的依赖。即statsmodels。


0
投票

sentiment.py文件中,将以下行添加到顶部:

```

!/usr/bin/env python

```

这对我有用。

© www.soinside.com 2019 - 2024. All rights reserved.