2013-10-28 104 views
1

夥計們, 以下Python腳本與EMR工作失敗

job state = FAILED 

終止
Last State Change: Access denied checking streaming input path: s3n://elasticmapreduce/samples/wordcount/input/ 

代碼:

import boto 
import boto.emr 
from boto.emr.step import StreamingStep 
from boto.emr.bootstrap_action import BootstrapAction 
import time 

S3_BUCKET="mytesetbucket123asdf" 
conn = boto.connect_emr() 

step = StreamingStep(
    name='Wordcount', 
    mapper='s3n://elasticmapreduce/samples/wordcount/wordSplitter.py', 
    reducer='aggregate', 
    input='s3n://elasticmapreduce/samples/wordcount/input/', 
    output='s3n://' + S3_BUCKET + '/wordcount/output/2013-10-25') 

jobid = conn.run_jobflow(
    name="test", 
    log_uri="s3://" + S3_BUCKET + "/logs/", 
    visible_to_all_users="True", 
    steps = [step],) 

state = conn.describe_jobflow(jobid).state 
print "job state = ", state 
print "job id = ", jobid 
while state != u'COMPLETED': 
    print time.localtime() 
    time.sleep(10) 
    state = conn.describe_jobflow(jobid).state 
    print conn.describe_jobflow(jobid) 
    print "job state = ", state 
    print "job id = ", jobid 

print "final output can be found in s3://" + S3_BUCKET + "/output" + TIMESTAMP 
print "try: $ s3cmd sync s3://" + S3_BUCKET + "/output" + TIMESTAMP + " ." 
+0

如果您嘗試'input ='s3n://會發生什麼elasticmapreduce/samples/wordcount/input',''或'input ='s3n:// elasticmapreduce/samples/wordcount/input/*''而不是? – alko

回答

0

的問題是在某處的Boto ...如果我們指定IAM用戶而不是使用角色,工作完美。 EMR支持IAM的課程角色......並且我們測試的IAM角色具有執行任何任務的完全權限,所以它不是錯誤配置問題...

+0

你可以發佈你的解決方案代碼嗎?謝謝 – ecoe