File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,8 +22,8 @@ def _get_session(self):
2222 thread_local .session = requests .Session ()
2323 return thread_local .session
2424
25- def _upload_chunk (self , task ):
26- print ("Starting next task... " )
25+ def _upload_chunk (self , task , i , total ):
26+ print (f "Starting chunk upload { i } / { total } " )
2727 url = task [0 ]
2828 chunk = task [1 ]
2929 session = self ._get_session ()
@@ -33,14 +33,14 @@ def _upload_chunk(self, task):
3333 'x-amz-acl' : 'private'
3434 })
3535
36+ print (f"Completed chunk { i } /{ total } " )
37+
3638 def upload (self ):
3739 total_size = self .asset ['filesize' ]
3840 upload_urls = self .asset ['upload_urls' ]
3941 size = int (math .ceil (total_size / len (upload_urls )))
4042
41- tasks = []
42-
4343 with concurrent .futures .ThreadPoolExecutor (max_workers = 5 ) as executor :
4444 for i , chunk in enumerate (self ._read_chunk (self .file , size )):
4545 task = (upload_urls [i ], chunk )
46- executor .submit (self ._upload_chunk , task )
46+ executor .submit (self ._upload_chunk , task , i , len ( upload_urls ) )
You can’t perform that action at this time.
0 commit comments