#NEWLINE# def delete( self , jobStoreID ) : #NEWLINE# #INDENT# log . debug ( 'Deleting job %s' , jobStoreID ) #NEWLINE# for attempt in retry_sdb ( ) : #NEWLINE# #INDENT# with attempt : #NEWLINE# #INDENT# self . jobsDomain . delete_attributes ( item_name = jobStoreID ) #NEWLINE# #UNINDENT# #UNINDENT# items = None #NEWLINE# for attempt in retry_sdb ( ) : #NEWLINE# #INDENT# with attempt : #NEWLINE# #INDENT# items = list ( self . filesDomain . select ( consistent_read = True , query = ( "select version from `%s` where ownerID='%s'" % ( self . filesDomain . name , jobStoreID ) ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# assert ( items is not None ) #NEWLINE# if items : #NEWLINE# #INDENT# log . debug ( 'Deleting %d file(s) associated with job %s' , len ( items ) , jobStoreID ) #NEWLINE# n = self . itemsPerBatchDelete #NEWLINE# batches = [ i [ i : ( i + n ) ] for i in range ( 0 , len ( items ) , n ) ] #NEWLINE# for batch in batches : #NEWLINE# #INDENT# itemsDict = { item . name : None for item in batch } #NEWLINE# for attempt in retry_sdb ( ) : #NEWLINE# #INDENT# with attempt : #NEWLINE# #INDENT# self . filesDomain . batch_delete_attributes ( itemsDict ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# for item in items : #NEWLINE# #INDENT# version = item . get ( 'version' ) #NEWLINE# if version : #NEWLINE# #INDENT# self . filesBucket . delete_key ( key_name = item . name , version_id = version ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . filesBucket . delete_key ( key_name = item . name )