Pydoop mapreduce "AttributeError: module 'wordcount_minimal' has no attribute '__main__'"

Pydoop mapreduce "AttributeError: module 'wordcount_minimal' has no attribute '__main__'"

我安装了 Pydoop 并正在尝试 运行 MapReduce 作业。只是为了干 运行,我尝试执行字数统计示例 wordcount_minimal.pywordcount_full.py。他们都挂在地图阶段。在 stderr 的末尾,我根据脚本 运行:

找到了这条消息

module 'wordcount_minimal' has no attribute 'main'

module 'wordcount_full' has no attribute 'main'

我使用命令执行作业:

pydoop submit --upload-file-to-cache wordcount_full.py wordcount_full hdfs_input_dir hdfs_output_dir

无法找到这背后的原因。知道可能是什么原因吗?

我能够使用 mapreduce 函数从 pydoop script 执行示例,并且成功完成。但是使用 pydoop submit 选项,我遇到了这个问题。不确定我是否遗漏了什么。

PS:我有一个包含 2 个节点的集群 运行ning Hortonworks HDP 2.6.5Pydoop 都安装在它们上。

默认情况下,pydoop 提交需要一个名为 __main__ 的入口点,但您可以通过 --entry-point 修改它。例如,如果您的代码是:

class Mapper ...
class Reducer ...
def run():
    pipes.run_task(pipes.Factory(Mapper, Reducer))

您可以 运行 通过 pydoop submit --entry-point run ...