Skip to content
Snippets Groups Projects
Commit 6c5a3f0a authored by Javier Jardón's avatar Javier Jardón
Browse files

buildstream/_project.py:

Multiprocessing with n_jobs given by multiprocessing.cpu_count() is not optimal for
systems where not all CPU can be used (in particular, Docker, CI etc).

As suggested in the multiprocessing docs
(http://docs.python.org/3/library/multiprocessing.html#multiprocessing.cpu_count)
using len(os.sched_getaffinity(0)) might be better.
parent f5683244
No related branches found
No related tags found
1 merge request!629[1.2] Backport of !620: Restrict max-jobs
......@@ -19,7 +19,6 @@
# Tiago Gomes <tiago.gomes@codethink.co.uk>
import os
import multiprocessing # for cpu_count()
from collections import Mapping, OrderedDict
from pluginbase import PluginBase
from . import utils
......@@ -572,7 +571,7 @@ class Project():
# Extend variables with automatic variables and option exports
# Initialize it as a string as all variables are processed as strings.
output.base_variables['max-jobs'] = str(multiprocessing.cpu_count())
output.base_variables['max-jobs'] = str(len(os.sched_getaffinity(0)))
# Export options into variables, if that was requested
output.options.export_variables(output.base_variables)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment