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

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

Issue 2480193002: Stop to use contextmanager for goma.build_with_goma (Closed)
Patch Set: use env_update Created 4 years, 1 month 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 ca0934597f11dcf24806afe7a49d83cd87b0ea80..26b022e7e1b01393fdc893b2aabedb4c8c973df1 100644
--- a/scripts/slave/recipe_modules/goma/api.py
+++ b/scripts/slave/recipe_modules/goma/api.py
@@ -85,7 +85,11 @@ print jobs
Args:
command: List of command line arg.
+
+ Returns:
+ list(string): Command line args parallel option removed.
"""
+ command = command[:]
parallel_flag_regexp = re.compile('-j\d*')
for i in range(len(command)):
if (isinstance(command[i], str) and
@@ -93,7 +97,8 @@ print jobs
if command[i] == '-j':
command.pop(i + 1)
command.pop(i)
- return
+ break
+ return command
def ensure_goma(self, canary=False):
with self.m.step.nest('ensure_goma'):
@@ -336,20 +341,28 @@ print jobs
This argument should be used with env.
If starting goma fails, env and ninja_log_command are modified.
ukai 2016/11/08 04:11:57 update comment?
tikuta 2016/11/09 05:31:12 Done.
+ Returns:
+ (env_update, command):
+ Please use env_update and command for ninja in build_with_goma context
+ (e.g. ninja_env.update(env_update)).
+ Appropriate values are set when starting goma fails.
+
Raises:
StepFailure or InfraFailure if it fails to build.
"""
ninja_log_exit_status = 0
-
if allow_build_without_goma:
assert(env is not None)
+ assert(ninja_log_command is not None)
+ env = env.copy()
+ ninja_log_command = ninja_log_command[:]
+
try:
self.start(env)
except:
- env['GOMA_DISABLED'] = 'true'
- self.remove_j_flag(ninja_log_command)
+ ninja_log_command = self.remove_j_flag(ninja_log_command)
try:
- yield
+ yield ({'GOMA_DISABLED':'true'}, ninja_log_command)
except self.m.step.StepFailure as e: # pragma: no cover
ninja_log_exit_status = e.retcode
raise e
@@ -367,7 +380,7 @@ print jobs
self.start(env)
try:
- yield
+ yield ({}, ninja_log_command)
except self.m.step.StepFailure as e: # pragma: no cover
ninja_log_exit_status = e.retcode
raise e

Powered by Google App Engine
This is Rietveld 408576698