#NEWLINE# def post( self , batch ) : #NEWLINE# #INDENT# num_jobs = len ( batch ) #NEWLINE# plural = ( '' if ( num_jobs == 1 ) else 's' ) #NEWLINE# log . info ( '> Sending batch request with %s job%s' , num_jobs , plural ) #NEWLINE# data = [ ] #NEWLINE# for ( i , job ) in enumerate ( batch ) : #NEWLINE# #INDENT# if job . finished : #NEWLINE# #INDENT# raise BatchFinished ( response ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# job . finished = True #NEWLINE# #UNINDENT# log . info ( '> {%s} %s' , i , job ) #NEWLINE# data . append ( dict ( job , id = i ) ) #NEWLINE# #UNINDENT# response = self . resource . post ( data ) #NEWLINE# log . info ( '< Received batch response for %s job%s' , num_jobs , plural ) #NEWLINE# return response