init: remove build_jobs global variable

This commit is contained in:
Todd Gamblin 2018-04-24 15:39:49 -07:00 committed by scheibelp
parent 2ab7b7a5a0
commit d4709673b5
3 changed files with 4 additions and 15 deletions

View file

@ -24,7 +24,6 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
############################################################################## ##############################################################################
import sys import sys
import multiprocessing
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# Below code imports spack packages. # Below code imports spack packages.
@ -33,22 +32,10 @@
# TODO: refactor everything below to be more init order agnostic. # TODO: refactor everything below to be more init order agnostic.
#-----------------------------------------------------------------------------
# Import spack.config first, as other modules may rely on its options.
# TODO: Below code should not import modules other than spack.config
#-----------------------------------------------------------------------------
import spack.config
# TODO: get this out of __init__.py # TODO: get this out of __init__.py
binary_cache_retrieved_specs = set() binary_cache_retrieved_specs = set()
#: The number of jobs to use when building in parallel.
#: By default, use all cores on the machine.
build_jobs = spack.config.get('config:build_jobs', multiprocessing.cpu_count())
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# Initialize various data structures & objects at the core of Spack. # Initialize various data structures & objects at the core of Spack.
# #

View file

@ -65,6 +65,7 @@
from llnl.util.tty.color import colorize from llnl.util.tty.color import colorize
from llnl.util.filesystem import mkdirp, install, install_tree from llnl.util.filesystem import mkdirp, install, install_tree
import spack.config
import spack.main import spack.main
import spack.paths import spack.paths
import spack.store import spack.store
@ -347,7 +348,7 @@ def set_module_variables_for_package(pkg, module):
This makes things easier for package writers. This makes things easier for package writers.
""" """
# number of jobs spack will build with. # number of jobs spack will build with.
jobs = spack.build_jobs jobs = spack.config.get('config:build_jobs') or multiprocessing.cpu_count()
if not pkg.parallel: if not pkg.parallel:
jobs = 1 jobs = 1
elif pkg.make_jobs: elif pkg.make_jobs:

View file

@ -54,6 +54,7 @@
import llnl.util.tty as tty import llnl.util.tty as tty
import spack import spack
import spack.config
import spack.paths import spack.paths
import spack.store import spack.store
import spack.compilers import spack.compilers
@ -506,7 +507,7 @@ class SomePackage(Package):
parallel = True parallel = True
#: # jobs to use for parallel make. If set, overrides default of ncpus. #: # jobs to use for parallel make. If set, overrides default of ncpus.
make_jobs = spack.build_jobs make_jobs = None
#: By default do not run tests within package's install() #: By default do not run tests within package's install()
run_tests = False run_tests = False