Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(297)

Unified Diff: scripts/slave/recipe_modules/goma/api.py

Issue 2291273005: Add counting the number of CPU's in goma module (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: scripts/slave/recipe_modules/goma/api.py
diff --git a/scripts/slave/recipe_modules/goma/api.py b/scripts/slave/recipe_modules/goma/api.py
index a2d939a2caf44a47c23cb1952d5b0693e48bfbee..9518f9a40ad499b40f5bd5ee8e324c1b3a17958f 100644
--- a/scripts/slave/recipe_modules/goma/api.py
+++ b/scripts/slave/recipe_modules/goma/api.py
@@ -14,6 +14,7 @@ class GomaApi(recipe_api.RecipeApi):
self._goma_ctl_env = {}
self._cloudtail_pid = None
+ self._goma_jobs = 50
ukai 2016/09/02 05:02:14 can recipe_module user configure specific number f
tikuta 2016/09/05 03:07:27 User can set jobs by themselves where they run bui
@property
def service_account_json_path(self):
@@ -31,6 +32,10 @@ class GomaApi(recipe_api.RecipeApi):
assert self._goma_dir
return self.m.path.join(self._goma_dir, 'jsonstatus')
+ @property
+ def goma_jobs(self):
+ return self._goma_jobs
+
def ensure_goma(self, canary=False):
with self.m.step.nest('ensure_goma'):
with self.m.step.context({'infra_step': True}):
@@ -65,6 +70,18 @@ class GomaApi(recipe_api.RecipeApi):
{goma_package: ref,
cloudtail_package: cloudtail_version})
+ step_result = self.m.python.inline(
+ 'get the number of cpus',
+ """
+ import multiprocessing
+ print min(200, multiprocessing.cpu_count() * 10)
shinyak 2016/09/01 09:38:28 I didn't set 200 for all platforms? Only Mac & Win
ukai 2016/09/02 05:02:14 https://docs.python.org/2.7/library/multiprocessin
tikuta 2016/09/05 03:01:37 Done.
tikuta 2016/09/05 03:01:37 For linux, I set 80 for the number of jobs.
+ """,
+ stdout=self.m.raw_io.output(),
+ step_test_data=(
+ lambda: self.m.raw_io.test_api.stream_output('40'))
+ )
+ self._goma_jobs = int(step_result.stdout)
+
return self._goma_dir
except self.m.step.StepFailure:
# TODO(phajdan.jr): make failures fatal after experiment.
« no previous file with comments | « scripts/slave/recipe_modules/cronet/example.expected/local_test.json ('k') | scripts/slave/recipe_modules/goma/example.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698