#NEWLINE# def wait_until_job_completed( jobs , sleep = 600 , tries = 144 ) : #NEWLINE# #INDENT# update_job_list ( jobs ) #NEWLINE# job = find_complete_job ( jobs ) #NEWLINE# while ( not job ) : #NEWLINE# #INDENT# tries -= 1 #NEWLINE# if ( tries < 0 ) : #NEWLINE# #INDENT# raise RuntimeError ( 'Timed out waiting for job completion' ) #NEWLINE# #UNINDENT# time . sleep ( sleep ) #NEWLINE# update_job_list ( jobs ) #NEWLINE# job = find_complete_job ( jobs ) #NEWLINE# #UNINDENT# return job