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 c3fd0dfe2d11f666b16e767ce6a5578a3b4cbcda..77279a028b61d7b8817214d600ca52f7394205e2 100644 |
--- a/scripts/slave/recipe_modules/goma/api.py |
+++ b/scripts/slave/recipe_modules/goma/api.py |
@@ -12,6 +12,18 @@ class GomaApi(recipe_api.RecipeApi): |
self._goma_dir = None |
self._goma_started = False |
+ self._env = {} |
Yoshisato Yanagisawa
2016/08/09 04:01:49
might be better to say goma_ctl_env or so?
tikuta
2016/08/09 05:30:39
Done.
|
+ |
+ # options for upload_goma_logs.py |
+ # TODO(tikuta) set these variables |
+ self._ninja_log_outdir = None |
+ self._ninja_log_compiler = None |
+ self._ninja_log_command = None |
+ self._ninja_log_exit_status = None |
+ |
+ self._build_data_dir = None |
+ |
+ |
@property |
def service_account_json_path(self): |
if self.m.platform.is_win: |
@@ -41,7 +53,11 @@ class GomaApi(recipe_api.RecipeApi): |
# TODO(phajdan.jr): make failures fatal after experiment. |
return None |
- def start(self, env=None, **kwargs): |
+ @property |
+ def goma_ctl(self): |
+ return self.m.path.join(self._goma_dir, 'goma_ctl.py') |
+ |
+ def start(self, build_data_dir, env=None, **kwargs): |
Yoshisato Yanagisawa
2016/08/09 04:01:49
might be better to make build_data_dir optional?
o
tikuta
2016/08/09 05:30:40
Done.
|
"""Start goma compiler_proxy. |
A user MUST execute ensure_goma beforehand. |
@@ -49,16 +65,25 @@ class GomaApi(recipe_api.RecipeApi): |
""" |
assert self._goma_dir |
assert not self._goma_started |
- if not env: |
- env = {} |
- env.update({'GOMA_SERVICE_ACCOUNT_JSON_FILE': self.service_account_json_path}) |
+ |
+ self._build_data_dir = build_data_dir |
+ self._env['GOMA_DUMP_STATS_FILE'] = ( |
+ self.m.path.join(build_data_dir, 'goma_stats_proto')) |
+ self._env['GOMACTL_CRASH_REPORT_ID_FILE'] = ( |
+ self.m.path.join(build_data_dir, 'crash_report_id_file')) |
+ |
+ self._env['GOMA_SERVICE_ACCOUNT_JSON_FILE'] = self.service_account_json_path |
+ |
+ if env: |
+ self._env.update(env) |
+ |
self.m.python( |
name='start_goma', |
- script=self.m.path.join(self._goma_dir, 'goma_ctl.py'), |
- args=['restart'], env=env, **kwargs) |
+ script=self.goma_ctl, |
+ args=['restart'], env=self._env, **kwargs) |
Yoshisato Yanagisawa
2016/08/09 04:01:49
can you upload stats on goma_start failure?
tikuta
2016/08/09 05:30:39
Done.
|
self._goma_started = True |
- def stop(self, goma_dir=None, **kwargs): |
+ def stop(self, **kwargs): |
"""Stop goma compiler_proxy. |
A user MUST execute start beforehand. |
@@ -68,6 +93,33 @@ class GomaApi(recipe_api.RecipeApi): |
assert self._goma_started |
self.m.python( |
name='stop_goma', |
- script=self.m.path.join(self._goma_dir, 'goma_ctl.py'), |
- args=['stop'], **kwargs) |
+ script=self.goma_ctl, |
+ args=['stop'], env=self._env, **kwargs) |
self._goma_started = False |
Yoshisato Yanagisawa
2016/08/09 04:01:49
should clear self._goma_ctl_env?
tikuta
2016/08/09 05:30:39
Done.
|
+ self.upload_logs() |
+ |
+ def upload_logs(self): |
+ args = [ |
+ '--upload-compiler-proxy-info' |
+ ] |
+ |
+ if self._ninja_log_outdir: |
+ args.extend([ |
+ '--ninja-log-outdir', self._ninja_log_outdir, |
+ '--ninja-log-compiler', self._ninja_log_compiler, |
+ '--ninja-log-command', self._ninja_log_command, |
+ '--ninja-log-exit-status', self._ninja_log_exit_status, |
+ ]) |
+ |
+ args.extend([ |
+ '--goma-stats-file', self._env['GOMA_DUMP_STATS_FILE'], |
+ '--goma-crash-report-id-file', |
+ self._env['GOMACTL_CRASH_REPORT_ID_FILE'], |
+ '--build-data-dir', self._build_data_dir, |
+ ]) |
+ |
+ self.m.python( |
+ name='upload_log', |
+ script='upload_goma_logs.py', |
+ args=args |
+ ) |