gpt4 book ai didi

python-2.7 - 无法在 python 中使用 mapreduce

转载 作者:行者123 更新时间:2023-12-02 08:38:11 24 4
gpt4 key购买 nike

我正在尝试使用 python mrjob 学习 mapreduce 程序。我收到以下错误:

回溯:

dumping stdin to local file /tmp/pyes_mrjob.testuser.20131004.103251.998597/STDIN
Making directory hdfs:///user/testuser/tmp/mrjob/pyes_mrjob.user.20131004.103251.998597/files/ on HDFS
> /usr/lib/hadoop-mapreduce/bin/hadoop fs -mkdir hdfs:///user/testuser/tmp/mrjob/pyes_mrjob.testuser.20131004.103251.998597/files/
Traceback (most recent call last):
File "pyes_mrjob.py", line 34, in <module>
MRWordFrequencyCount.run()
File "/usr/local/lib/python2.7/dist-packages/mrjob/job.py", line 500, in run
mr_job.execute()
File "/usr/local/lib/python2.7/dist-packages/mrjob/job.py", line 518, in execute
super(MRJob, self).execute()
File "/usr/local/lib/python2.7/dist-packages/mrjob/launch.py", line 146, in execute
self.run_job()
File "/usr/local/lib/python2.7/dist-packages/mrjob/launch.py", line 207, in run_job
runner.run()
File "/usr/local/lib/python2.7/dist-packages/mrjob/runner.py", line 458, in run
self._run()
File "/usr/local/lib/python2.7/dist-packages/mrjob/hadoop.py", line 236, in _run
self._upload_local_files_to_hdfs()
File "/usr/local/lib/python2.7/dist-packages/mrjob/hadoop.py", line 263, in _upload_local_files_to_hdfs
self._mkdir_on_hdfs(self._upload_mgr.prefix)
File "/usr/local/lib/python2.7/dist-packages/mrjob/hadoop.py", line 271, in _mkdir_on_hdfs
self.invoke_hadoop(['fs', '-mkdir', path])
File "/usr/local/lib/python2.7/dist-packages/mrjob/fs/hadoop.py", line 81, in invoke_hadoop
proc = Popen(args, stdout=PIPE, stderr=PIPE)
File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory

我手动执行命令,它在那里工作正常,但是当我尝试执行我的程序时,它不起作用。由于刚开始学习,有人可以建议我必须选择哪个图书馆。根据一些博客,一些图书馆有很好的文档,一些图书馆有更好的性能......我在下面看到了看起来更旧的帖子 http://blog.cloudera.com/blog/2013/01/a-guide-to-python-frameworks-for-hadoop/

但是最近很多图书馆都得到了更新。所以有人可以建议我可以开始的图书馆..

最佳答案

我猜这个问题是由于 mrjob 调用“hadoop fs -mkdir”的方式引起的,如果你想要创建的目标目录的父目录不存在,-mkdir 将失败。这意味着您必须使用“hadoop fs -mkdir -p [path]”。最后,你需要在[mrjob安装路径](我的是/usr/lib/python2.6/site-packages/mrjob)/hadoop.py 271行手动修改mrjob库:

self.invoke_hadoop(['fs', '-mkdir', path])

self.invoke_hadoop(['fs', '-mkdir', '-p', path])

祝你好运!

关于python-2.7 - 无法在 python 中使用 mapreduce,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19179507/

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