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