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

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

Issue 2237403002: Add cloudtail start/stop in recipe_modules/goma (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: remove import os Created 4 years, 4 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 db1b0061f82875595c795a87a8aaae0adf1407aa..579188dab502d578e636fdefbeb773f4d339c8d0 100644
--- a/scripts/slave/recipe_modules/goma/api.py
+++ b/scripts/slave/recipe_modules/goma/api.py
@@ -13,6 +13,7 @@ class GomaApi(recipe_api.RecipeApi):
self._goma_started = False
self._goma_ctl_env = {}
+ self._cloudtail_pid = None
@property
def service_account_json_path(self):
@@ -20,6 +21,12 @@ class GomaApi(recipe_api.RecipeApi):
return 'C:\\creds\\service_accounts\\service-account-goma-client.json'
return '/creds/service_accounts/service-account-goma-client.json'
+ @property
+ def cloudtail_path(self):
+ if self.m.platform.is_win:
+ return 'C:\\infra-tools\\cloudtail'
+ return '/opt/infra-tools/cloudtail'
+
def ensure_goma(self, canary=False):
with self.m.step.nest('ensure_goma'):
with self.m.step.context({'infra_step': True}):
@@ -38,6 +45,10 @@ class GomaApi(recipe_api.RecipeApi):
ref='candidate'
self._goma_dir = self.m.path['cache'].join('cipd', 'goma')
self.m.cipd.ensure(self._goma_dir, {goma_package: ref})
+
+ # TODO(tikuta) download cloudtail from cipd here
+
+
return self._goma_dir
except self.m.step.StepFailure:
# TODO(phajdan.jr): make failures fatal after experiment.
@@ -51,6 +62,28 @@ class GomaApi(recipe_api.RecipeApi):
def build_data_dir(self):
return self.m.properties.get('build_data_dir')
+ def start_cloudtail(self):
+ assert self._cloudtail_pid is None
+
+ step_result = self.m.python(
+ name='start cloudtail',
+ script=self.resource('cloudtail_utils.py'),
+ args=['--start-cloudtail',
+ '--cloudtail-path', self.cloudtail_path,
+ '--log-id', 'goma_compiler_proxy',
Yoshisato Yanagisawa 2016/08/16 03:45:23 remove this?
tikuta 2016/08/16 03:59:31 Done.
+ ],
+ env=self._goma_ctl_env,
+ stdout=self.m.raw_io.output())
+
+ self._cloudtail_pid = step_result.stdout
+
+ def stop_cloudtail(self):
+ self.m.python(
+ name='stop cloudtail',
+ script=self.resource('cloudtail_utils.py'),
+ args=['--killed-pid', self._cloudtail_pid])
+ self._cloudtail_pid = None
+
def start(self, env=None, **kwargs):
"""Start goma compiler_proxy.
@@ -94,6 +127,8 @@ class GomaApi(recipe_api.RecipeApi):
self.upload_logs(name=upload_logs_name)
raise e
+ self.start_cloudtail()
+
def stop(self, ninja_log_outdir=None, ninja_log_compiler=None,
ninja_log_command=None, ninja_log_exit_status=None, **kwargs):
"""Stop goma compiler_proxy.
@@ -108,6 +143,7 @@ class GomaApi(recipe_api.RecipeApi):
script=self.goma_ctl,
args=['stop'], env=self._goma_ctl_env, **kwargs)
+ self.stop_cloudtail()
self.upload_logs(ninja_log_outdir, ninja_log_compiler, ninja_log_command,
ninja_log_exit_status)

Powered by Google App Engine
This is Rietveld 408576698