OLD | NEW |
---|---|
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 from contextlib import contextmanager | 5 from contextlib import contextmanager |
6 | 6 |
7 from recipe_engine import recipe_api | 7 from recipe_engine import recipe_api |
8 | 8 |
9 class GomaApi(recipe_api.RecipeApi): | 9 class GomaApi(recipe_api.RecipeApi): |
10 """GomaApi contains helper functions for using goma.""" | 10 """GomaApi contains helper functions for using goma.""" |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
132 Raises: | 132 Raises: |
133 InfraFailure if it fails to start cloudtail | 133 InfraFailure if it fails to start cloudtail |
134 """ | 134 """ |
135 | 135 |
136 assert self._cloudtail_pid is None | 136 assert self._cloudtail_pid is None |
137 | 137 |
138 step_result = self.m.python( | 138 step_result = self.m.python( |
139 name='start cloudtail', | 139 name='start cloudtail', |
140 script=self.resource('cloudtail_utils.py'), | 140 script=self.resource('cloudtail_utils.py'), |
141 args=['start', | 141 args=['start', |
142 '--cloudtail-path', self.cloudtail_path], | 142 '--cloudtail-path', self.cloudtail_path, |
143 '--pid-file', self.m.raw_io.output(name='pid')], | |
ukai
2016/09/29 07:26:09
use leak_to and reuse it in stop_cloudtail ?
tikuta
2016/09/29 07:46:15
Done.
| |
143 env=self._goma_ctl_env, | 144 env=self._goma_ctl_env, |
144 stdout=self.m.raw_io.output(), | |
145 step_test_data=( | 145 step_test_data=( |
146 lambda: self.m.raw_io.test_api.stream_output('12345')), | 146 lambda: self.m.raw_io.test_api.output('12345', name='pid')), |
147 infra_step=True) | 147 infra_step=True) |
148 | 148 self._cloudtail_pid = step_result.raw_io.outputs['pid'] |
149 self._cloudtail_pid = step_result.stdout | |
150 | 149 |
151 def _stop_cloudtail(self): | 150 def _stop_cloudtail(self): |
152 """Stop cloudtail started by _start_cloudtail | 151 """Stop cloudtail started by _start_cloudtail |
153 | 152 |
154 Raises: | 153 Raises: |
155 InfraFailure if it fails to stop cloudtail | 154 InfraFailure if it fails to stop cloudtail |
156 """ | 155 """ |
157 | 156 |
158 assert self._cloudtail_pid is not None | 157 assert self._cloudtail_pid is not None |
159 | 158 |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
325 ninja_log_exit_status = e.retcode | 324 ninja_log_exit_status = e.retcode |
326 raise e | 325 raise e |
327 except self.m.step.InfraFailure as e: # pragma: no cover | 326 except self.m.step.InfraFailure as e: # pragma: no cover |
328 ninja_log_exit_status = -1 | 327 ninja_log_exit_status = -1 |
329 raise e | 328 raise e |
330 finally: | 329 finally: |
331 self.stop(ninja_log_outdir=ninja_log_outdir, | 330 self.stop(ninja_log_outdir=ninja_log_outdir, |
332 ninja_log_compiler=ninja_log_compiler, | 331 ninja_log_compiler=ninja_log_compiler, |
333 ninja_log_command=ninja_log_command, | 332 ninja_log_command=ninja_log_command, |
334 ninja_log_exit_status=ninja_log_exit_status) | 333 ninja_log_exit_status=ninja_log_exit_status) |
OLD | NEW |