#NEWLINE# def block_until_complete( jenkinsurl , jobs , maxwait = 12000 , interval = 30 , raise_on_timeout = True ) : #NEWLINE# #INDENT# '\n    Wait until all of the jobs in the list are complete.\n    ' #NEWLINE# assert ( maxwait > 0 ) #NEWLINE# assert ( maxwait > interval ) #NEWLINE# assert ( interval > 0 ) #NEWLINE# obj_jenkins = Jenkins ( jenkinsurl ) #NEWLINE# obj_jobs = [ obj_jenkins [ jid ] for jid in jobs ] #NEWLINE# for time_left in xrange ( maxwait , 0 , ( - interval ) ) : #NEWLINE# #INDENT# still_running = [ str_still_running for j in obj_jobs if j . is_queued_or_running ( ) ] #NEWLINE# if ( not still_running ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# str_still_running = ', ' . join ( ( ( '"%s"' % str ( a ) ) for a in still_running ) ) #NEWLINE# log . warn ( ( 'Waiting for jobs %s to complete. Will wait another %is' % ( str_still_running , time_left ) ) ) #NEWLINE# time . sleep ( interval ) #NEWLINE# #UNINDENT# if raise_on_timeout : #NEWLINE# #INDENT# raise TimeOut ( ( 'Waited too long for these jobs to complete: %s' % str_still_running ) )