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

Side by Side Diff: scripts/slave/recipe_modules/step/api.py

Issue 1076643002: Reland of 'Make allow_subannotations more robust' (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Fixed SET_BUILD_PROPERTY parse failure Created 5 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « scripts/slave/annotated_run.py ('k') | scripts/slave/recipes/example/subannotations.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 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 slave import recipe_api 5 from slave import recipe_api
6 from slave import recipe_util 6 from slave import recipe_util
7 7
8 # Inherit from RecipeApiPlain because the only thing which is a step is 8 # Inherit from RecipeApiPlain because the only thing which is a step is
9 # run_from_dict() 9 # run_from_dict()
10 class StepApi(recipe_api.RecipeApiPlain): 10 class StepApi(recipe_api.RecipeApiPlain):
11 def __init__(self, **kwargs):
12 super(StepApi, self).__init__(**kwargs)
13 self._step_names = {}
14
15 EXCEPTION = 'EXCEPTION' 11 EXCEPTION = 'EXCEPTION'
16 FAILURE = 'FAILURE' 12 FAILURE = 'FAILURE'
17 SUCCESS = 'SUCCESS' 13 SUCCESS = 'SUCCESS'
18 WARNING = 'WARNING' 14 WARNING = 'WARNING'
19 15
20 @property 16 @property
21 def StepFailure(self): 17 def StepFailure(self):
22 """ See recipe_api.py for docs. """ 18 """ See recipe_api.py for docs. """
23 return recipe_api.StepFailure 19 return recipe_api.StepFailure
24 20
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 assert 'shell' not in kwargs 84 assert 'shell' not in kwargs
89 assert isinstance(cmd, list) 85 assert isinstance(cmd, list)
90 if not ok_ret: 86 if not ok_ret:
91 ok_ret = {0} 87 ok_ret = {0}
92 if ok_ret in ('any', 'all'): 88 if ok_ret in ('any', 'all'):
93 ok_ret = set(range(-256, 256)) 89 ok_ret = set(range(-256, 256))
94 90
95 command = list(wrapper) 91 command = list(wrapper)
96 command += cmd 92 command += cmd
97 93
98 step_count = self._step_names.setdefault(name, 0) + 1
99 self._step_names[name] = step_count
100 if step_count > 1:
101 name = "%s (%d)" % (name, step_count)
102
103 kwargs.update({'name': name, 'cmd': command}) 94 kwargs.update({'name': name, 'cmd': command})
104 kwargs['ok_ret'] = ok_ret 95 kwargs['ok_ret'] = ok_ret
105 kwargs['infra_step'] = bool(infra_step) 96 kwargs['infra_step'] = bool(infra_step)
106 97
107 schema = self.make_config() 98 schema = self.make_config()
108 schema.set_val(kwargs) 99 schema.set_val(kwargs)
109 return self.run_from_dict(self._engine.create_step(schema)) 100 return self.run_from_dict(self._engine.create_step(schema))
110 101
111 # TODO(martiniss) delete, and make generator_script use **kwargs on step() 102 # TODO(martiniss) delete, and make generator_script use **kwargs on step()
112 @recipe_api.composite_step 103 @recipe_api.composite_step
113 def run_from_dict(self, dct): 104 def run_from_dict(self, dct):
114 return self._engine.run_step(dct) 105 return self._engine.run_step(dct)
OLDNEW
« no previous file with comments | « scripts/slave/annotated_run.py ('k') | scripts/slave/recipes/example/subannotations.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698