#NEWLINE# @ defer . inlineCallbacks #NEWLINE# def upload( self , fname , upload , progq ) : #NEWLINE# #INDENT# with self . _workers ( progq ) as pool : #NEWLINE# #INDENT# etags = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# source = ChunkedFile ( fname , self . state . progress ) #NEWLINE# token = ( yield upload . status ) #NEWLINE# for seq in count ( start = self . state . seq ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# source = ( yield threads . deferToThread ( seq . upload_temp , token , source , etags , pool , seq ) ) #NEWLINE# #UNINDENT# except PauseEvent : #NEWLINE# #INDENT# getLogger ( ) . debug ( 'paused after uploading %d temporary keys' , seq ) #NEWLINE# raise #NEWLINE# #UNINDENT# except TimeoutError : #NEWLINE# #INDENT# getLogger ( ) . debug ( 'timeout after uploading %d temporary keys' , seq ) #NEWLINE# token = ( yield upload . status ) #NEWLINE# #UNINDENT# if ( source is None ) : #NEWLINE# #INDENT# getLogger ( ) . debug ( 'uploaded entire archive' ) #NEWLINE# break #NEWLINE# #UNINDENT# #UNINDENT# getLogger ( ) . debug ( 'uploaded %d temp keys' , len ( etags ) ) #NEWLINE# for ( key , tag ) in etags . iteritems ( ) : #NEWLINE# #INDENT# getLogger ( ) . debug ( 'key: %s (etag: %s)' , key , tag )