| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 common import constants | 7 from common import constants |
| 8 from model.flake.flake_analysis_request import FlakeAnalysisRequest | 8 from model.flake.flake_analysis_request import FlakeAnalysisRequest |
| 9 from waterfall.flake import initialize_flake_pipeline | 9 from waterfall.flake import initialize_flake_pipeline |
| 10 from waterfall.flake import step_mapper | 10 from waterfall.flake import step_mapper |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 request.user_emails = [user_email] | 197 request.user_emails = [user_email] |
| 198 | 198 |
| 199 manually_triggered = user_email.endswith('@google.com') | 199 manually_triggered = user_email.endswith('@google.com') |
| 200 | 200 |
| 201 for build_step in request.build_steps: | 201 for build_step in request.build_steps: |
| 202 step_mapper.FindMatchingWaterfallStep(build_step) | 202 step_mapper.FindMatchingWaterfallStep(build_step) |
| 203 | 203 |
| 204 version_number, build_step = _CheckForNewAnalysis(request) | 204 version_number, build_step = _CheckForNewAnalysis(request) |
| 205 if version_number and build_step: | 205 if version_number and build_step: |
| 206 # A new analysis is needed. | 206 # A new analysis is needed. |
| 207 # TODO(lijeffrey): Add support for the force flag to trigger a rerun. |
| 207 logging.info('A new analysis is needed for: %s', build_step) | 208 logging.info('A new analysis is needed for: %s', build_step) |
| 208 analysis = initialize_flake_pipeline.ScheduleAnalysisIfNeeded( | 209 analysis = initialize_flake_pipeline.ScheduleAnalysisIfNeeded( |
| 209 build_step.wf_master_name, build_step.wf_builder_name, | 210 build_step.wf_master_name, build_step.wf_builder_name, |
| 210 build_step.wf_build_number, build_step.wf_step_name, | 211 build_step.wf_build_number, build_step.wf_step_name, |
| 211 request.name, allow_new_analysis=True, | 212 request.name, allow_new_analysis=True, |
| 212 manually_triggered=manually_triggered, user_email=user_email, | 213 manually_triggered=manually_triggered, user_email=user_email, |
| 213 triggering_source=triggering_source, | 214 triggering_source=triggering_source, |
| 214 queue_name=constants.WATERFALL_ANALYSIS_QUEUE) | 215 queue_name=constants.WATERFALL_ANALYSIS_QUEUE) |
| 215 if analysis: | 216 if analysis: |
| 216 # TODO: put this in a transaction. | 217 # TODO: put this in a transaction. |
| 217 request = FlakeAnalysisRequest.GetVersion( | 218 request = FlakeAnalysisRequest.GetVersion( |
| 218 key=request.name, version=version_number) | 219 key=request.name, version=version_number) |
| 219 request.analyses.append(analysis.key) | 220 request.analyses.append(analysis.key) |
| 220 request.put() | 221 request.put() |
| 221 logging.info('A new analysis was triggered successfully: %s', | 222 logging.info('A new analysis was triggered successfully: %s', |
| 222 analysis.key) | 223 analysis.key) |
| 223 return True | 224 return True |
| 224 else: | 225 else: |
| 225 logging.error('But new analysis was not triggered!') | 226 logging.error('But new analysis was not triggered!') |
| 226 else: | 227 else: |
| 227 logging.info('No new analysis is needed: %s', request) | 228 logging.info('No new analysis is needed: %s', request) |
| 228 | 229 |
| 229 return False | 230 return False |
| OLD | NEW |