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 import logging | 5 import logging |
| 6 | 6 |
| 7 from google.appengine.api import modules | 7 from google.appengine.api import modules |
| 8 from google.appengine.ext import ndb | 8 from google.appengine.ext import ndb |
| 9 | 9 |
| 10 from model import wf_analysis_status | 10 from model import wf_analysis_status |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 72 else: | 72 else: |
| 73 targeted_tests.append(failure_name) | 73 targeted_tests.append(failure_name) |
| 74 | 74 |
| 75 need_new_try_job = need_new_try_job or failure_need_try_job | 75 need_new_try_job = need_new_try_job or failure_need_try_job |
| 76 last_pass = (failure_last_pass if failure_last_pass and | 76 last_pass = (failure_last_pass if failure_last_pass and |
| 77 failure_last_pass < last_pass else last_pass) | 77 failure_last_pass < last_pass else last_pass) |
| 78 | 78 |
| 79 return targeted_tests, need_new_try_job, last_pass | 79 return targeted_tests, need_new_try_job, last_pass |
| 80 | 80 |
| 81 | 81 |
| 82 def _StripPlatform(targeted_tests): | |
|
lijeffrey
2016/03/10 00:43:56
nit: just for clarity maybe rename this '_GetTarge
chanli
2016/03/10 23:31:51
Function deleted.
| |
| 83 if not targeted_tests: | |
| 84 return None | |
| 85 | |
| 86 updated_tests = {} | |
| 87 for step_name, tests in targeted_tests.iteritems(): | |
| 88 updated_tests[step_name.strip()[0]] = tests | |
|
stgao
2016/03/10 00:39:30
How about using the value of tag "name" in the Swa
lijeffrey
2016/03/10 00:43:56
are you sure you want step_name.strip()[0]? I thin
chanli
2016/03/10 23:31:51
Right... I wanted to use split... Done
chanli
2016/03/10 23:31:51
You're right, and actually this patch won't work b
| |
| 89 | |
| 90 return updated_tests | |
| 91 | |
| 92 | |
| 82 @ndb.transactional | 93 @ndb.transactional |
| 83 def _NeedANewTryJob( | 94 def _NeedANewTryJob( |
| 84 master_name, builder_name, build_number, failed_steps, failure_result_map): | 95 master_name, builder_name, build_number, failed_steps, failure_result_map): |
| 85 """Checks if a new try_job is needed.""" | 96 """Checks if a new try_job is needed.""" |
| 86 need_new_try_job = False | 97 need_new_try_job = False |
| 87 last_pass = build_number | 98 last_pass = build_number |
| 88 | 99 |
| 89 if 'compile' in failed_steps: | 100 if 'compile' in failed_steps: |
| 90 try_job_type = TryJobType.COMPILE | 101 try_job_type = TryJobType.COMPILE |
| 91 targeted_tests = None | 102 targeted_tests = None |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 107 if try_job.failed: | 118 if try_job.failed: |
| 108 try_job.status = wf_analysis_status.PENDING | 119 try_job.status = wf_analysis_status.PENDING |
| 109 try_job.put() | 120 try_job.put() |
| 110 else: | 121 else: |
| 111 need_new_try_job = False | 122 need_new_try_job = False |
| 112 else: | 123 else: |
| 113 try_job = WfTryJob.Create( | 124 try_job = WfTryJob.Create( |
| 114 master_name, builder_name, build_number) | 125 master_name, builder_name, build_number) |
| 115 try_job.put() | 126 try_job.put() |
| 116 | 127 |
| 128 targeted_tests = _StripPlatform(targeted_tests) | |
| 129 | |
| 117 return need_new_try_job, last_pass, try_job_type, targeted_tests | 130 return need_new_try_job, last_pass, try_job_type, targeted_tests |
| 118 | 131 |
| 119 | 132 |
| 120 def _GetFailedTargetsFromSignals(signals): | 133 def _GetFailedTargetsFromSignals(signals): |
| 121 compile_targets = [] | 134 compile_targets = [] |
| 122 | 135 |
| 123 if not signals or 'compile' not in signals: | 136 if not signals or 'compile' not in signals: |
| 124 return compile_targets | 137 return compile_targets |
| 125 | 138 |
| 126 for source_target in signals['compile']['failed_targets']: | 139 for source_target in signals['compile']['failed_targets']: |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 181 pipeline.pipeline_status_path, try_job_type) | 194 pipeline.pipeline_status_path, try_job_type) |
| 182 else: # pragma: no cover | 195 else: # pragma: no cover |
| 183 logging_str = ( | 196 logging_str = ( |
| 184 'Try job was scheduled for build %s, %s, %s: %s because of %s ' | 197 'Try job was scheduled for build %s, %s, %s: %s because of %s ' |
| 185 'failure.') % ( | 198 'failure.') % ( |
| 186 master_name, builder_name, build_number, | 199 master_name, builder_name, build_number, |
| 187 pipeline.pipeline_status_path, try_job_type) | 200 pipeline.pipeline_status_path, try_job_type) |
| 188 logging.info(logging_str) | 201 logging.info(logging_str) |
| 189 | 202 |
| 190 return failure_result_map | 203 return failure_result_map |
| OLD | NEW |