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

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: generate *.json 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
« no previous file with comments | « scripts/slave/recipe_modules/goma/__init__.py ('k') | scripts/slave/recipe_modules/goma/example.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..e7d80611171e5d912b3ea65ca5ceb4c6dd6674d3 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,37 @@ class GomaApi(recipe_api.RecipeApi):
def build_data_dir(self):
return self.m.properties.get('build_data_dir')
+ def start_cloudtail(self):
ukai 2016/08/16 05:46:06 doc string? _start_cloudtail, if it is not expect
tikuta 2016/08/16 06:04:04 Done.
+ assert self._cloudtail_pid is None
+
+ step_result = self.m.python(
ukai 2016/08/16 05:46:06 when it failed, stop goma?
tikuta 2016/08/16 06:04:04 Done.
+ name='start cloudtail',
+ script=self.resource('cloudtail_utils.py'),
+ args=['--start-cloudtail',
+ '--cloudtail-path', self.cloudtail_path],
+ env=self._goma_ctl_env,
+ stdout=self.m.raw_io.output())
+
+ self._cloudtail_pid = step_result.stdout
+
+ def stop_cloudtail(self):
ukai 2016/08/16 05:46:06 doc string? _stop_cloudtail?
tikuta 2016/08/16 06:04:04 Done.
+ assert self._cloudtail_pid is not None
shinyak 2016/08/16 05:48:39 If start_cloudtail failed, this assert can be trig
tikuta 2016/08/16 06:04:04 I missed the location to reflect the comment about
+
+ try:
+ self.m.python(
+ name='stop cloudtail',
+ script=self.resource('cloudtail_utils.py'),
+ args=['--killed-pid', self._cloudtail_pid],
+ infra_step=True)
+ except self.m.step.InfraFailure as e: # pragma: no cover
+ self.m.python(
+ name='stop_goma (cloudtail start failure)',
ukai 2016/08/16 05:46:07 cloudtail stop failure?
tikuta 2016/08/16 06:04:04 Done.
+ script=self.goma_ctl,
+ args=['stop'], env=self._goma_ctl_env)
+ raise e
+
+ self._cloudtail_pid = None
+
def start(self, env=None, **kwargs):
"""Start goma compiler_proxy.
@@ -94,6 +136,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 +152,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)
« no previous file with comments | « scripts/slave/recipe_modules/goma/__init__.py ('k') | scripts/slave/recipe_modules/goma/example.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698