| 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 """This module is to provide Findit service APIs through Cloud Endpoints: | 5 """This module is to provide Findit service APIs through Cloud Endpoints: |
| 6 | 6 |
| 7 Current APIs include: | 7 Current APIs include: |
| 8 1. Analysis of compile/test failures in Chromium waterfalls. | 8 1. Analysis of compile/test failures in Chromium waterfalls. |
| 9 Analyzes failures and detects suspected CLs. | 9 Analyzes failures and detects suspected CLs. |
| 10 2. Analysis of flakes on Commit Queue. | 10 2. Analysis of flakes on Commit Queue. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 from common import constants | 23 from common import constants |
| 24 from common import time_util | 24 from common import time_util |
| 25 from common.waterfall import failure_type | 25 from common.waterfall import failure_type |
| 26 from model.flake.flake_analysis_request import FlakeAnalysisRequest | 26 from model.flake.flake_analysis_request import FlakeAnalysisRequest |
| 27 from model.wf_analysis import WfAnalysis | 27 from model.wf_analysis import WfAnalysis |
| 28 from model.wf_swarming_task import WfSwarmingTask | 28 from model.wf_swarming_task import WfSwarmingTask |
| 29 from model.wf_try_job import WfTryJob | 29 from model.wf_try_job import WfTryJob |
| 30 from waterfall import buildbot | 30 from waterfall import buildbot |
| 31 from waterfall import waterfall_config | 31 from waterfall import waterfall_config |
| 32 from waterfall.flake import flake_analysis_service | 32 from waterfall.flake import flake_analysis_service |
| 33 from waterfall.flake import triggering_sources |
| 33 | 34 |
| 34 | 35 |
| 35 # This is used by the underlying ProtoRpc when creating names for the ProtoRPC | 36 # This is used by the underlying ProtoRpc when creating names for the ProtoRPC |
| 36 # messages below. This package name will show up as a prefix to the message | 37 # messages below. This package name will show up as a prefix to the message |
| 37 # class names in the discovery doc and client libraries. | 38 # class names in the discovery doc and client libraries. |
| 38 package = 'FindIt' | 39 package = 'FindIt' |
| 39 | 40 |
| 40 | 41 |
| 41 # These subclasses of Message are basically definitions of Protocol RPC | 42 # These subclasses of Message are basically definitions of Protocol RPC |
| 42 # messages. https://cloud.google.com/appengine/docs/python/tools/protorpc/ | 43 # messages. https://cloud.google.com/appengine/docs/python/tools/protorpc/ |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 analysis_request = FlakeAnalysisRequest.Create( | 294 analysis_request = FlakeAnalysisRequest.Create( |
| 294 flake.name, flake.is_step, flake.bug_id) | 295 flake.name, flake.is_step, flake.bug_id) |
| 295 for step in flake.build_steps: | 296 for step in flake.build_steps: |
| 296 analysis_request.AddBuildStep(step.master_name, step.builder_name, | 297 analysis_request.AddBuildStep(step.master_name, step.builder_name, |
| 297 step.build_number, step.step_name, | 298 step.build_number, step.step_name, |
| 298 time_util.GetUTCNow()) | 299 time_util.GetUTCNow()) |
| 299 return analysis_request | 300 return analysis_request |
| 300 | 301 |
| 301 logging.info('Flake: %s', CreateFlakeAnalysisRequest(request)) | 302 logging.info('Flake: %s', CreateFlakeAnalysisRequest(request)) |
| 302 analysis_triggered = flake_analysis_service.ScheduleAnalysisForFlake( | 303 analysis_triggered = flake_analysis_service.ScheduleAnalysisForFlake( |
| 303 CreateFlakeAnalysisRequest(request), user_email, is_admin) | 304 CreateFlakeAnalysisRequest(request), user_email, is_admin, |
| 305 triggering_sources.FINDIT_API) |
| 304 | 306 |
| 305 if analysis_triggered is None: | 307 if analysis_triggered is None: |
| 306 raise endpoints.UnauthorizedException( | 308 raise endpoints.UnauthorizedException( |
| 307 'No permission for a new analysis! User is %s' % user_email) | 309 'No permission for a new analysis! User is %s' % user_email) |
| 308 | 310 |
| 309 return _FlakeAnalysis(analysis_triggered=analysis_triggered) | 311 return _FlakeAnalysis(analysis_triggered=analysis_triggered) |
| OLD | NEW |