summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorBenjamin Schubert <bschubert15@bloomberg.net>2020-07-03 12:57:06 +0000
committerBenjamin Schubert <bschubert15@bloomberg.net>2020-12-04 10:36:37 +0000
commit705d0023f65621b23b6b0828306dc5b4ee094b45 (patch)
treec021c06427c7e37508c682bc99e06d9eae090975 /setup.py
parentbe88eaec0445ff2d85b73c17a392d0e65620202b (diff)
downloadbuildstream-705d0023f65621b23b6b0828306dc5b4ee094b45.tar.gz
scheduler.py: Use threads instead of processes for jobs
This changes how the scheduler works and adapts all the code that needs adapting in order to be able to run in threads instead of in subprocesses, which helps with Windows support, and will allow some simplifications in the main pipeline. This addresses the following issues: * Fix #810: All CAS calls are now made in the master process, and thus share the same connection to the cas server * Fix #93: We don't start as many child processes anymore, so the risk of starving the machine are way less * Fix #911: We now use `forkserver` for starting processes. We also don't use subprocesses for jobs so we should be starting less subprocesses And the following highlevel changes where made: * cascache.py: Run the CasCacheUsageMonitor in a thread instead of a subprocess. * casdprocessmanager.py: Ensure start and stop of the process are thread safe. * job.py: Run the child in a thread instead of a process, adapt how we stop a thread, since we ca't use signals anymore. * _multiprocessing.py: Not needed anymore, we are not using `fork()`. * scheduler.py: Run the scheduler with a threadpool, to run the child jobs in. Also adapt how our signal handling is done, since we are not receiving signals from our children anymore, and can't kill them the same way. * sandbox: Stop using blocking signals to wait on the process, and use timeouts all the time. * messenger.py: Use a thread-local context for the handler, to allow for multiple parameters in the same process. * _remote.py: Ensure the start of the connection is thread safe * _signal.py: Allow blocking entering in the signal's context managers by setting an event. This is to ensure no thread runs long-running code while we asked the scheduler to pause. This also ensures all the signal handlers is thread safe. * source.py: Change check around saving the source's ref. We are now running in the same process, and thus the ref will already have been changed.
Diffstat (limited to 'setup.py')
-rwxr-xr-xsetup.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/setup.py b/setup.py
index a7c698030..18b5e42be 100755
--- a/setup.py
+++ b/setup.py
@@ -319,6 +319,7 @@ BUILD_EXTENSIONS = []
register_cython_module("buildstream.node")
register_cython_module("buildstream._loader._loader")
register_cython_module("buildstream._loader.loadelement", dependencies=["buildstream.node"])
+register_cython_module("buildstream._scheduler.jobs._job")
register_cython_module("buildstream._yaml", dependencies=["buildstream.node"])
register_cython_module("buildstream._types")
register_cython_module("buildstream._utils")