0
我一直在为此挣扎2个小时!在AWS EMR上的MapReduce代码中导入自定义函数
我在python中创建了一个mapper脚本,它正在导入其他python脚本中的一个自定义函数。
#!/usr/bin/env python
import sys
import testImport
for line in sys.stdin:
if line and line!='':
words = line.strip().lower().split('\t')
print '%s\t%s' % (words[0].strip(),testImport.age_classify(int(words[1])))
此代码适用于我的终端....问题是当我将此映射器函数上传到AWS Elastic MapReduce。我的作业失败,错误显示“导入模块testImport失败”。
testImport是一个'testImport.py'文件,其中包含我的一些帮助函数(如age_classify函数),我需要对每行标准输入进行操作。
我上传了脚本与我的映射器脚本(给定的脚本)在同一个存储桶中。
我试图通过它在参数部分,当我添加'流程节目'一步。即使看到所有相关问题,我也不知道该怎么做。
我怎样才能做到这一点?
任何帮助都会非常棒!
谢谢!
看看[mrjob](https://github.com/Yelp/mrjob) – Mehraban 2014-11-09 06:34:46