@@ -994,6 +994,16 @@ def included(self, subtarget):
994
994
def new_result (self ):
995
995
return ProjectListResult ()
996
996
997
+ def start_process (self , project_subbuilder , default_timeout ):
998
+ """
999
+ Sets the default timeout in the global variable of a newly started subprocess
1000
+ and builds `project_subbuilder` afterwards.
1001
+ If we invoked project_subbilder.build() immediately in the new process, it would
1002
+ not inherit the default timeout from the parent process.
1003
+ """
1004
+ common .set_default_execute_timeout (default_timeout )
1005
+ project_subbuilder .build ()
1006
+
997
1007
def build (self , stdout = sys .stdout ):
998
1008
# Setup process pool to submit work to
999
1009
thread_pool = futures .ProcessPoolExecutor (max_workers = self .processes )
@@ -1010,7 +1020,7 @@ def build(self, stdout=sys.stdout):
1010
1020
# For each project that needs building, submit a future to build said project
1011
1021
for project in projects_to_build :
1012
1022
project_subbuilder = self .subbuilder .initialize (* ([project ] + self .payload ()))
1013
- worker = thread_pool .submit (project_subbuilder . build )
1023
+ worker = thread_pool .submit (self . start_process , project_subbuilder , common . DEFAULT_EXECUTE_TIMEOUT )
1014
1024
submitted_futures .append (worker )
1015
1025
1016
1026
# Cleanup in main process
0 commit comments