Chromium Code Reviews| 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 """An interface for holding state and result of revisions in a bisect job. | 5 """An interface for holding state and result of revisions in a bisect job. |
| 6 | 6 |
| 7 When implementing support for tests other than perf, one should extend this | 7 When implementing support for tests other than perf, one should extend this |
| 8 class so that the bisect module and recipe can use it. | 8 class so that the bisect module and recipe can use it. |
| 9 | 9 |
| 10 See perf_revision_state for an example. | 10 See perf_revision_state for an example. |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 68 self.next_revision = None | 68 self.next_revision = None |
| 69 self.previous_revision = None | 69 self.previous_revision = None |
| 70 self.job_name = None | 70 self.job_name = None |
| 71 self.patch_file = None | 71 self.patch_file = None |
| 72 self.deps_revision = None | 72 self.deps_revision = None |
| 73 self.depot_name = depot_name or self.bisector.base_depot | 73 self.depot_name = depot_name or self.bisector.base_depot |
| 74 self.depot = depot_config.DEPOT_DEPS_NAME[self.depot_name] | 74 self.depot = depot_config.DEPOT_DEPS_NAME[self.depot_name] |
| 75 self.commit_hash = str(commit_hash) | 75 self.commit_hash = str(commit_hash) |
| 76 self._rev_str = None | 76 self._rev_str = None |
| 77 self.base_revision = base_revision | 77 self.base_revision = base_revision |
| 78 self.snapshot = [] | |
| 78 if self.base_revision: | 79 if self.base_revision: |
| 79 assert self.base_revision.deps_file_contents | 80 assert self.base_revision.deps_file_contents |
| 80 self.needs_patch = True | 81 self.needs_patch = True |
| 81 self.deps_patch, self.deps_file_contents = self.bisector.make_deps_patch( | 82 self.deps_patch, self.deps_file_contents = self.bisector.make_deps_patch( |
| 82 self.base_revision, self.base_revision.deps_file_contents, | 83 self.base_revision, self.base_revision.deps_file_contents, |
| 83 self.depot, self.commit_hash) | 84 self.depot, self.commit_hash) |
| 84 self.deps_sha = hashlib.sha1(self.deps_patch).hexdigest() | 85 self.deps_sha = hashlib.sha1(self.deps_patch).hexdigest() |
| 85 self.deps_sha_patch = self.bisector.make_deps_sha_file(self.deps_sha) | 86 self.deps_sha_patch = self.bisector.make_deps_sha_file(self.deps_sha) |
| 86 self.deps = dict(base_revision.deps) | 87 self.deps = dict(base_revision.deps) |
| 87 self.deps[self.depot_name] = self.commit_hash | 88 self.deps[self.depot_name] = self.commit_hash |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 176 'From': lambda *args: None, | 177 'From': lambda *args: None, |
| 177 } | 178 } |
| 178 return deps_data | 179 return deps_data |
| 179 | 180 |
| 180 def _read_content(self, url, file_name, branch): # pragma: no cover | 181 def _read_content(self, url, file_name, branch): # pragma: no cover |
| 181 """Uses gitiles recipe module to download and read file contents.""" | 182 """Uses gitiles recipe module to download and read file contents.""" |
| 182 try: | 183 try: |
| 183 return self.bisector.api.m.gitiles.download_file( | 184 return self.bisector.api.m.gitiles.download_file( |
| 184 repository_url=url, file_path=file_name, branch=branch) | 185 repository_url=url, file_path=file_name, branch=branch) |
| 185 except TypeError: | 186 except TypeError: |
| 186 print 'Could not read content for %s/%s/%s' % (url, file_name, branch) | 187 print 'Could not read content for %s/%s/%s' % (url, file_name, branch) |
| 187 return None | 188 return None |
| 188 | 189 |
| 189 def read_deps(self, recipe_tester_name): | 190 def read_deps(self, recipe_tester_name): |
| 190 """Sets the dependencies for this revision from the contents of DEPS.""" | 191 """Sets the dependencies for this revision from the contents of DEPS.""" |
| 191 api = self.bisector.api | 192 api = self.bisector.api |
| 192 if self.deps: | 193 if self.deps: |
| 193 return | 194 return |
| 194 if self.bisector.internal_bisect: # pragma: no cover | 195 if self.bisector.internal_bisect: # pragma: no cover |
| 195 self.deps_file_contents = self._read_content( | 196 self.deps_file_contents = self._read_content( |
| 196 depot_config.DEPOT_DEPS_NAME[self.depot_name]['url'], | 197 depot_config.DEPOT_DEPS_NAME[self.depot_name]['url'], |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 483 'revision_ladder': revision_ladder, | 484 'revision_ladder': revision_ladder, |
| 484 }, | 485 }, |
| 485 } | 486 } |
| 486 self.test_results_url = (self.bisector.api.GS_RESULTS_URL + | 487 self.test_results_url = (self.bisector.api.GS_RESULTS_URL + |
| 487 self.job_name + '.results') | 488 self.job_name + '.results') |
| 488 if (api.m.bisect_tester.local_test_enabled() or | 489 if (api.m.bisect_tester.local_test_enabled() or |
| 489 self.bisector.internal_bisect): # pragma: no cover | 490 self.bisector.internal_bisect): # pragma: no cover |
| 490 skip_download = self.bisector.last_tested_revision == self | 491 skip_download = self.bisector.last_tested_revision == self |
| 491 self.bisector.last_tested_revision = self | 492 self.bisector.last_tested_revision = self |
| 492 overrides = perf_test_properties['properties'] | 493 overrides = perf_test_properties['properties'] |
| 494 snapshot_result = api.m.step('Take a Snapshot of CPU', | |
| 495 ["python","resources/cpu_usage.py"], | |
|
RobertoCN
2016/06/03 18:01:42
instead of "resources/cpu_usage.py" use api.resour
| |
| 496 stdout=api.m.json.output()) | |
| 497 process_list = snapshot_result.stdout | |
| 498 self.snapshot = process_list | |
| 499 api.m.step.active_result.presentation.logs['CPU snapshot'] = process_list | |
| 493 api.run_local_test_run(overrides, skip_download=skip_download) | 500 api.run_local_test_run(overrides, skip_download=skip_download) |
| 494 else: | 501 else: |
| 495 step_name = 'Triggering test job for ' + self.commit_hash | 502 step_name = 'Triggering test job for ' + self.commit_hash |
| 496 api.m.trigger(perf_test_properties, name=step_name) | 503 api.m.trigger(perf_test_properties, name=step_name) |
| 497 | 504 |
| 498 def retest(self): # pragma: no cover | 505 def retest(self): # pragma: no cover |
| 499 # We need at least 5 samples for applying Mann-Whitney U test | 506 # We need at least 5 samples for applying Mann-Whitney U test |
| 500 # with P < 0.01, two-tailed . | 507 # with P < 0.01, two-tailed . |
| 501 target_sample_size = max(5, math.ceil(len(self.values) * 1.5)) | 508 target_sample_size = max(5, math.ceil(len(self.values) * 1.5)) |
| 502 self.status = RevisionState.NEED_MORE_DATA | 509 self.status = RevisionState.NEED_MORE_DATA |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 602 else: | 609 else: |
| 603 next_revision_to_test.retest() | 610 next_revision_to_test.retest() |
| 604 | 611 |
| 605 def __repr__(self): | 612 def __repr__(self): |
| 606 if self.overall_return_code is not None: | 613 if self.overall_return_code is not None: |
| 607 return ('RevisionState(rev=%s, values=%r, overall_return_code=%r, ' | 614 return ('RevisionState(rev=%s, values=%r, overall_return_code=%r, ' |
| 608 'std_dev=%r)') % (self.revision_string(), self.values, | 615 'std_dev=%r)') % (self.revision_string(), self.values, |
| 609 self.overall_return_code, self.std_dev) | 616 self.overall_return_code, self.std_dev) |
| 610 return ('RevisionState(rev=%s, values=%r, mean_value=%r, std_dev=%r)' % ( | 617 return ('RevisionState(rev=%s, values=%r, mean_value=%r, std_dev=%r)' % ( |
| 611 self.revision_string(), self.values, self.mean_value, self.std_dev)) | 618 self.revision_string(), self.values, self.mean_value, self.std_dev)) |
| OLD | NEW |