@@ -665,9 +665,9 @@ async def _runLocalSCMs(self, step, logger):
665665 def getStatistic (self ):
666666 return self .__statistic
667667
668- def __createGenericTask (self , coro ):
668+ def __createGenericTask (self , loop , coro ):
669669 """Create and return task for coroutine."""
670- return asyncio . get_event_loop () .create_task (self .__taskWrapper (coro ))
670+ return loop .create_task (self .__taskWrapper (coro ))
671671
672672 def __createCookTask (self , coro , step , checkoutOnly , tracker , count ):
673673 """Create and return task for a cook()-like coroutine.
@@ -756,7 +756,7 @@ async def __taskWrapper(self, coro, trackingKey=None, tracker=None,
756756 self .__buildErrors .append (e )
757757 raise CancelBuildException
758758
759- def cook (self , steps , checkoutOnly , depth = 0 ):
759+ def cook (self , steps , checkoutOnly , loop , depth = 0 ):
760760 def cancelJobs ():
761761 if self .__jobs > 1 :
762762 log ("Cancel all running jobs..." , WARNING )
@@ -767,19 +767,18 @@ def cancelJobs():
767767 async def dispatcher ():
768768 if self .__jobs > 1 :
769769 packageJobs = [
770- self .__createGenericTask (lambda s = step : self ._cookTask (s , checkoutOnly , depth ))
770+ self .__createGenericTask (loop , lambda s = step : self ._cookTask (s , checkoutOnly , depth ))
771771 for step in steps ]
772772 await gatherTasks (packageJobs )
773773 else :
774774 packageJobs = []
775775 for step in steps :
776- job = self .__createGenericTask (lambda s = step : self ._cookTask (s , checkoutOnly , depth ))
776+ job = self .__createGenericTask (loop , lambda s = step : self ._cookTask (s , checkoutOnly , depth ))
777777 packageJobs .append (job )
778778 await asyncio .wait ({job })
779779 # retrieve results as last step to --keep-going
780780 for job in packageJobs : job .result ()
781781
782- loop = asyncio .get_event_loop ()
783782 self .__restart = True
784783 while self .__restart :
785784 self .__running = True
@@ -801,7 +800,7 @@ async def dispatcher():
801800 self .__tasksDone = 0
802801 self .__tasksNum = 0
803802
804- j = self .__createGenericTask (dispatcher )
803+ j = self .__createGenericTask (loop , dispatcher )
805804 try :
806805 loop .add_signal_handler (signal .SIGINT , cancelJobs )
807806 except NotImplementedError :
0 commit comments