Skip to content

Commit d7ee51e

Browse files
authored
Merge pull request #693 from ahoppen/pr/inherit-default-timeout
Pass the default process timeout from the main process to the subprocesses that build the projects
2 parents a40cecf + 2b0aa67 commit d7ee51e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

project.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -994,6 +994,16 @@ def included(self, subtarget):
994994
def new_result(self):
995995
return ProjectListResult()
996996

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+
9971007
def build(self, stdout=sys.stdout):
9981008
# Setup process pool to submit work to
9991009
thread_pool = futures.ProcessPoolExecutor(max_workers=self.processes)
@@ -1010,7 +1020,7 @@ def build(self, stdout=sys.stdout):
10101020
# For each project that needs building, submit a future to build said project
10111021
for project in projects_to_build:
10121022
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)
10141024
submitted_futures.append(worker)
10151025

10161026
# Cleanup in main process

0 commit comments

Comments
 (0)