jeudi 4 juin 2015

my code is always printing "COMPLETED" and dont exit the while loop

I have a mapreducejob where I define a jobid:

jobid = emr.run_jobflow(name="Data Processing"

After mapreduce job I want to show a message "Completed Job" when mapreduce job status == "COMPLETED".

Im trying to do this with code below, but Im having always the status like:

STARTING STARTING .... RUNNING ... COMPLETED COMPLETED COMPLETED COMPLETED

The problem is that it is always printing "COMPLETED" and dont exit the while loop. And I want to exit so it shows the message "Completed Job".

Do you see where the issue is?

status = emr.describe_jobflow(jobid)    

while status.state != 'COMPLETED' or status.state != 'FAILED':      
    status = emr.describe_jobflow(jobid)
    print status.state

print "Job status:" + str(status.state)
print ""
print "Completed Job"




Aucun commentaire:

Enregistrer un commentaire