Skip to content

Commit

Permalink
update from mongodb for limiting ninja max jobs from commit: 0b620c24…
Browse files Browse the repository at this point in the history
…c55859f325ce23daa90b3c1c55bc76cb
  • Loading branch information
dmoody256 committed Jun 2, 2021
1 parent a20a886 commit a9bf0d4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions SCons/Tool/ninja/NinjaState.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,10 @@ def __init__(self, env, ninja_file, writer_class):
"pool": "local_pool",
}

num_jobs = self.env.get('NINJA_MAX_JOBS', self.env.GetOption("num_jobs"))
self.pools = {
"local_pool": self.env.GetOption("num_jobs"),
"install_pool": self.env.GetOption("num_jobs") / 2,
"local_pool": num_jobs,
"install_pool": num_jobs / 2,
"scons_pool": 1,
}

Expand Down Expand Up @@ -301,12 +302,14 @@ def generate(self):
ninja.variable("builddir", get_path(self.env['NINJA_BUILDDIR']))

for pool_name, size in self.pools.items():
ninja.pool(pool_name, size)
ninja.pool(pool_name, min(self.env.get('NINJA_MAX_JOBS', size), size))

for var, val in self.variables.items():
ninja.variable(var, val)

for rule, kwargs in self.rules.items():
if self.env.get('NINJA_MAX_JOBS') is not None and 'pool' not in kwargs:
kwargs['pool'] = 'local_pool'
ninja.rule(rule, **kwargs)

generated_source_files = sorted({
Expand Down

0 comments on commit a9bf0d4

Please sign in to comment.