From d4709673b571f882d6f10e4e317addd46ded65f2 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Tue, 24 Apr 2018 15:39:49 -0700 Subject: [PATCH] init: remove build_jobs global variable --- lib/spack/spack/__init__.py | 13 ------------- lib/spack/spack/build_environment.py | 3 ++- lib/spack/spack/package.py | 3 ++- 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/lib/spack/spack/__init__.py b/lib/spack/spack/__init__.py index ac35e79d80..b6492dc1a0 100644 --- a/lib/spack/spack/__init__.py +++ b/lib/spack/spack/__init__.py @@ -24,7 +24,6 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## import sys -import multiprocessing #----------------------------------------------------------------------------- # Below code imports spack packages. @@ -33,22 +32,10 @@ # 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 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. # diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py index fc7b12f8fd..d4f6e36e56 100644 --- a/lib/spack/spack/build_environment.py +++ b/lib/spack/spack/build_environment.py @@ -65,6 +65,7 @@ from llnl.util.tty.color import colorize from llnl.util.filesystem import mkdirp, install, install_tree +import spack.config import spack.main import spack.paths import spack.store @@ -347,7 +348,7 @@ def set_module_variables_for_package(pkg, module): This makes things easier for package writers. """ # 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: jobs = 1 elif pkg.make_jobs: diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py index 83acb16ce8..a2e588079e 100644 --- a/lib/spack/spack/package.py +++ b/lib/spack/spack/package.py @@ -54,6 +54,7 @@ import llnl.util.tty as tty import spack +import spack.config import spack.paths import spack.store import spack.compilers @@ -506,7 +507,7 @@ class SomePackage(Package): parallel = True #: # 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() run_tests = False