@@ -89,10 +89,11 @@ def canUploadJenkins(self):
8989 def canCache (self ):
9090 return False
9191
92- async def uploadPackage (self , step , buildId , audit , content ):
92+ async def uploadPackage (self , step , buildId , audit , content , executor = None ):
9393 pass
9494
95- async def downloadPackage (self , step , buildId , audit , content , caches = []):
95+ async def downloadPackage (self , step , buildId , audit , content , caches = [],
96+ executor = None ):
9697 return False
9798
9899 def upload (self , step , buildIdFile , tgzFile ):
@@ -101,19 +102,19 @@ def upload(self, step, buildIdFile, tgzFile):
101102 def download (self , step , buildIdFile , tgzFile ):
102103 return ""
103104
104- async def uploadLocalLiveBuildId (self , step , liveBuildId , buildId ):
105+ async def uploadLocalLiveBuildId (self , step , liveBuildId , buildId , executor = None ):
105106 pass
106107
107- async def downloadLocalLiveBuildId (self , step , liveBuildId ):
108+ async def downloadLocalLiveBuildId (self , step , liveBuildId , executor = None ):
108109 return None
109110
110111 def uploadJenkinsLiveBuildId (self , step , liveBuildId , buildId , isWin ):
111112 return ""
112113
113- async def uploadLocalFingerprint (self , step , key , fingerprint ):
114+ async def uploadLocalFingerprint (self , step , key , fingerprint , executor = None ):
114115 pass
115116
116- async def downloadLocalFingerprint (self , step , key ):
117+ async def downloadLocalFingerprint (self , step , key , executor = None ):
117118 return None
118119
119120 def uploadJenkinsFingerprint (self , step , keyFile , fingerprintFile ):
@@ -199,7 +200,8 @@ def __extractPackage(self, tar, audit, content):
199200 def _openDownloadFile (self , buildId , suffix ):
200201 raise ArtifactNotFoundError ()
201202
202- async def downloadPackage (self , step , buildId , audit , content , caches = []):
203+ async def downloadPackage (self , step , buildId , audit , content , caches = [],
204+ executor = None ):
203205 if not self .canDownloadLocal ():
204206 return False
205207
@@ -208,7 +210,7 @@ async def downloadPackage(self, step, buildId, audit, content, caches=[]):
208210 details = " from {}" .format (self ._remoteName (buildId , suffix ))
209211 with stepAction (step , "DOWNLOAD" , content , details = details ) as a :
210212 try :
211- ret , msg , kind = await loop .run_in_executor (None , BaseArchive ._downloadPackage ,
213+ ret , msg , kind = await loop .run_in_executor (executor , BaseArchive ._downloadPackage ,
212214 self , buildId , suffix , audit , content , caches )
213215 if not ret : a .fail (msg , kind )
214216 return ret
@@ -255,14 +257,14 @@ def _downloadPackage(self, buildId, suffix, audit, content, caches):
255257 # to prevent ugly backtraces when user presses ctrl+c.
256258 signal .signal (signal .SIGINT , signal .SIG_DFL )
257259
258- async def downloadLocalLiveBuildId (self , step , liveBuildId ):
260+ async def downloadLocalLiveBuildId (self , step , liveBuildId , executor = None ):
259261 if not self .canDownloadLocal ():
260262 return None
261263
262264 loop = asyncio .get_event_loop ()
263265 with stepAction (step , "MAP-SRC" , self ._remoteName (liveBuildId , BUILDID_SUFFIX ), (INFO ,TRACE )) as a :
264266 try :
265- ret , msg , kind = await loop .run_in_executor (None ,
267+ ret , msg , kind = await loop .run_in_executor (executor ,
266268 BaseArchive ._downloadLocalFile , self , liveBuildId , BUILDID_SUFFIX )
267269 if ret is None : a .fail (msg , kind )
268270 return ret
@@ -294,7 +296,7 @@ def _downloadLocalFile(self, key, suffix):
294296 def _openUploadFile (self , buildId , suffix ):
295297 raise ArtifactUploadError ("not implemented" )
296298
297- async def uploadPackage (self , step , buildId , audit , content ):
299+ async def uploadPackage (self , step , buildId , audit , content , executor = None ):
298300 if not self .canUploadLocal ():
299301 return
300302 if not audit :
@@ -307,7 +309,7 @@ async def uploadPackage(self, step, buildId, audit, content):
307309 details = " to {}" .format (self ._remoteName (buildId , suffix ))
308310 with stepAction (step , "UPLOAD" , content , details = details ) as a :
309311 try :
310- msg , kind = await loop .run_in_executor (None , BaseArchive ._uploadPackage ,
312+ msg , kind = await loop .run_in_executor (executor , BaseArchive ._uploadPackage ,
311313 self , buildId , suffix , audit , content )
312314 a .setResult (msg , kind )
313315 except (concurrent .futures .CancelledError , concurrent .futures .process .BrokenProcessPool ):
@@ -339,14 +341,14 @@ def _uploadPackage(self, buildId, suffix, audit, content):
339341 signal .signal (signal .SIGINT , signal .SIG_DFL )
340342 return ("ok" , EXECUTED )
341343
342- async def uploadLocalLiveBuildId (self , step , liveBuildId , buildId ):
344+ async def uploadLocalLiveBuildId (self , step , liveBuildId , buildId , executor = None ):
343345 if not self .canUploadLocal ():
344346 return
345347
346348 loop = asyncio .get_event_loop ()
347349 with stepAction (step , "CACHE-BID" , self ._remoteName (liveBuildId , BUILDID_SUFFIX ), (INFO ,TRACE )) as a :
348350 try :
349- msg , kind = await loop .run_in_executor (None , BaseArchive ._uploadLocalFile , self , liveBuildId , BUILDID_SUFFIX , buildId )
351+ msg , kind = await loop .run_in_executor (executor , BaseArchive ._uploadLocalFile , self , liveBuildId , BUILDID_SUFFIX , buildId )
350352 a .setResult (msg , kind )
351353 except (concurrent .futures .CancelledError , concurrent .futures .process .BrokenProcessPool ):
352354 raise BuildError ("Upload of build-id interrupted." )
@@ -372,26 +374,26 @@ def _uploadLocalFile(self, key, suffix, content):
372374 signal .signal (signal .SIGINT , signal .SIG_DFL )
373375 return ("ok" , EXECUTED )
374376
375- async def uploadLocalFingerprint (self , step , key , fingerprint ):
377+ async def uploadLocalFingerprint (self , step , key , fingerprint , executor = None ):
376378 if not self .canUploadLocal ():
377379 return
378380
379381 loop = asyncio .get_event_loop ()
380382 with stepAction (step , "CACHE-FPR" , self ._remoteName (key , FINGERPRINT_SUFFIX )) as a :
381383 try :
382- msg , kind = await loop .run_in_executor (None , BaseArchive ._uploadLocalFile , self , key , FINGERPRINT_SUFFIX , fingerprint )
384+ msg , kind = await loop .run_in_executor (executor , BaseArchive ._uploadLocalFile , self , key , FINGERPRINT_SUFFIX , fingerprint )
383385 a .setResult (msg , kind )
384386 except (concurrent .futures .CancelledError , concurrent .futures .process .BrokenProcessPool ):
385387 raise BuildError ("Upload of build-id interrupted." )
386388
387- async def downloadLocalFingerprint (self , step , key ):
389+ async def downloadLocalFingerprint (self , step , key , executor = None ):
388390 if not self .canDownloadLocal ():
389391 return None
390392
391393 loop = asyncio .get_event_loop ()
392394 with stepAction (step , "MAP-FPRNT" , self ._remoteName (key , FINGERPRINT_SUFFIX )) as a :
393395 try :
394- ret , msg , kind = await loop .run_in_executor (None ,
396+ ret , msg , kind = await loop .run_in_executor (executor ,
395397 BaseArchive ._downloadLocalFile , self , key , FINGERPRINT_SUFFIX )
396398 if ret is None : a .fail (msg , kind )
397399 return ret
@@ -1193,16 +1195,16 @@ def canDownloadJenkins(self):
11931195 def canUploadJenkins (self ):
11941196 return any (i .canUploadJenkins () for i in self .__archives )
11951197
1196- async def uploadPackage (self , step , buildId , audit , content ):
1198+ async def uploadPackage (self , step , buildId , audit , content , executor = None ):
11971199 for i in self .__archives :
11981200 if not i .canUploadLocal (): continue
1199- await i .uploadPackage (step , buildId , audit , content )
1201+ await i .uploadPackage (step , buildId , audit , content , executor = executor )
12001202
1201- async def downloadPackage (self , step , buildId , audit , content ):
1203+ async def downloadPackage (self , step , buildId , audit , content , executor = None ):
12021204 for i in self .__archives :
12031205 if not i .canDownloadLocal (): continue
12041206 caches = [ a for a in self .__archives if (a is not i ) and a .canCache () ]
1205- if await i .downloadPackage (step , buildId , audit , content , caches ):
1207+ if await i .downloadPackage (step , buildId , audit , content , caches , executor ):
12061208 return True
12071209 return False
12081210
@@ -1216,16 +1218,16 @@ def download(self, step, buildIdFile, tgzFile):
12161218 i .download (step , buildIdFile , tgzFile ) for i in self .__archives
12171219 if i .canDownloadJenkins ())
12181220
1219- async def uploadLocalLiveBuildId (self , step , liveBuildId , buildId ):
1221+ async def uploadLocalLiveBuildId (self , step , liveBuildId , buildId , executor = None ):
12201222 for i in self .__archives :
12211223 if not i .canUploadLocal (): continue
1222- await i .uploadLocalLiveBuildId (step , liveBuildId , buildId )
1224+ await i .uploadLocalLiveBuildId (step , liveBuildId , buildId , executor = executor )
12231225
1224- async def downloadLocalLiveBuildId (self , step , liveBuildId ):
1226+ async def downloadLocalLiveBuildId (self , step , liveBuildId , executor = None ):
12251227 ret = None
12261228 for i in self .__archives :
12271229 if not i .canDownloadLocal (): continue
1228- ret = await i .downloadLocalLiveBuildId (step , liveBuildId )
1230+ ret = await i .downloadLocalLiveBuildId (step , liveBuildId , executor = executor )
12291231 if ret is not None : break
12301232 return ret
12311233
@@ -1234,16 +1236,16 @@ def uploadJenkinsLiveBuildId(self, step, liveBuildId, buildId, isWin):
12341236 i .uploadJenkinsLiveBuildId (step , liveBuildId , buildId , isWin )
12351237 for i in self .__archives if i .canUploadJenkins ())
12361238
1237- async def uploadLocalFingerprint (self , step , key , fingerprint ):
1239+ async def uploadLocalFingerprint (self , step , key , fingerprint , executor = None ):
12381240 for i in self .__archives :
12391241 if not i .canUploadLocal (): continue
1240- await i .uploadLocalFingerprint (step , key , fingerprint )
1242+ await i .uploadLocalFingerprint (step , key , fingerprint , executor = executor )
12411243
1242- async def downloadLocalFingerprint (self , step , key ):
1244+ async def downloadLocalFingerprint (self , step , key , executor = None ):
12431245 ret = None
12441246 for i in self .__archives :
12451247 if not i .canDownloadLocal (): continue
1246- ret = await i .downloadLocalFingerprint (step , key )
1248+ ret = await i .downloadLocalFingerprint (step , key , executor = executor )
12471249 if ret is not None : break
12481250 return ret
12491251
0 commit comments