| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Entry point for fully-annotated builds. | 6 """Entry point for fully-annotated builds. |
| 7 | 7 |
| 8 This script is part of the effort to move all builds to annotator-based | 8 This script is part of the effort to move all builds to annotator-based |
| 9 systems. Any builder configured to use the AnnotatorFactory.BaseFactory() | 9 systems. Any builder configured to use the AnnotatorFactory.BaseFactory() |
| 10 found in scripts/master/factory/annotator_factory.py executes a single | 10 found in scripts/master/factory/annotator_factory.py executes a single |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 ]] | 87 ]] |
| 88 | 88 |
| 89 | 89 |
| 90 class StepPresentation(object): | 90 class StepPresentation(object): |
| 91 STATUSES = set(('SUCCESS', 'FAILURE', 'WARNING', 'EXCEPTION')) | 91 STATUSES = set(('SUCCESS', 'FAILURE', 'WARNING', 'EXCEPTION')) |
| 92 | 92 |
| 93 def __init__(self): | 93 def __init__(self): |
| 94 self._finalized = False | 94 self._finalized = False |
| 95 | 95 |
| 96 self._logs = collections.OrderedDict() | 96 self._logs = collections.OrderedDict() |
| 97 self._links = collections.OrderedDict() |
| 97 self._perf_logs = collections.OrderedDict() | 98 self._perf_logs = collections.OrderedDict() |
| 98 self._status = None | 99 self._status = None |
| 99 self._step_summary_text = '' | 100 self._step_summary_text = '' |
| 100 self._step_text = '' | 101 self._step_text = '' |
| 101 | 102 |
| 102 # (E0202) pylint bug: http://www.logilab.org/ticket/89092 | 103 # (E0202) pylint bug: http://www.logilab.org/ticket/89092 |
| 103 @property | 104 @property |
| 104 def status(self): # pylint: disable=E0202 | 105 def status(self): # pylint: disable=E0202 |
| 105 return self._status | 106 return self._status |
| 106 | 107 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 129 self._step_summary_text = val | 130 self._step_summary_text = val |
| 130 | 131 |
| 131 @property | 132 @property |
| 132 def logs(self): | 133 def logs(self): |
| 133 if not self._finalized: | 134 if not self._finalized: |
| 134 return self._logs | 135 return self._logs |
| 135 else: | 136 else: |
| 136 return copy.deepcopy(self._logs) | 137 return copy.deepcopy(self._logs) |
| 137 | 138 |
| 138 @property | 139 @property |
| 140 def links(self): |
| 141 if not self._finalized: |
| 142 return self._links |
| 143 else: |
| 144 return copy.deepcopy(self._links) |
| 145 |
| 146 @property |
| 139 def perf_logs(self): | 147 def perf_logs(self): |
| 140 if not self._finalized: | 148 if not self._finalized: |
| 141 return self._perf_logs | 149 return self._perf_logs |
| 142 else: | 150 else: |
| 143 return copy.deepcopy(self._perf_logs) | 151 return copy.deepcopy(self._perf_logs) |
| 144 | 152 |
| 145 def finalize(self, annotator_step): | 153 def finalize(self, annotator_step): |
| 146 self._finalized = True | 154 self._finalized = True |
| 147 if self.step_text: | 155 if self.step_text: |
| 148 annotator_step.step_text(self.step_text) | 156 annotator_step.step_text(self.step_text) |
| 149 if self.step_summary_text: | 157 if self.step_summary_text: |
| 150 annotator_step.step_summary_text(self.step_summary_text) | 158 annotator_step.step_summary_text(self.step_summary_text) |
| 151 for name, lines in self.logs.iteritems(): | 159 for name, lines in self.logs.iteritems(): |
| 152 annotator_step.write_log_lines(name, lines) | 160 annotator_step.write_log_lines(name, lines) |
| 153 for name, lines in self.perf_logs.iteritems(): | 161 for name, lines in self.perf_logs.iteritems(): |
| 154 annotator_step.write_log_lines(name, lines, perf=True) | 162 annotator_step.write_log_lines(name, lines, perf=True) |
| 163 for label, url in self.links.iteritems(): |
| 164 annotator_step.step_link(label, url) |
| 155 status_mapping = { | 165 status_mapping = { |
| 156 'WARNING': annotator_step.step_warnings, | 166 'WARNING': annotator_step.step_warnings, |
| 157 'FAILURE': annotator_step.step_failure, | 167 'FAILURE': annotator_step.step_failure, |
| 158 'EXCEPTION': annotator_step.step_exception, | 168 'EXCEPTION': annotator_step.step_exception, |
| 159 } | 169 } |
| 160 status_mapping.get(self.status, lambda: None)() | 170 status_mapping.get(self.status, lambda: None)() |
| 161 | 171 |
| 162 | 172 |
| 163 class StepData(object): | 173 class StepData(object): |
| 164 def __init__(self, step, retcode): | 174 def __init__(self, step, retcode): |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 | 446 |
| 437 def shell_main(argv): | 447 def shell_main(argv): |
| 438 if UpdateScripts(): | 448 if UpdateScripts(): |
| 439 return subprocess.call([sys.executable] + argv) | 449 return subprocess.call([sys.executable] + argv) |
| 440 else: | 450 else: |
| 441 return main(argv) | 451 return main(argv) |
| 442 | 452 |
| 443 | 453 |
| 444 if __name__ == '__main__': | 454 if __name__ == '__main__': |
| 445 sys.exit(shell_main(sys.argv)) | 455 sys.exit(shell_main(sys.argv)) |
| OLD | NEW |