Chromium Code Reviews| 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 from datetime import timedelta | 6 from datetime import timedelta |
| 7 import random | 7 import random |
| 8 import textwrap | |
| 8 | 9 |
| 9 from common import appengine_util | 10 from common import appengine_util |
| 10 from common import constants | 11 from common import constants |
| 11 from common import time_util | 12 from common import time_util |
| 12 from common.pipeline_wrapper import BasePipeline | 13 from common.pipeline_wrapper import BasePipeline |
| 13 | 14 |
| 14 from model import analysis_status | 15 from model import analysis_status |
| 15 from model.flake.flake_swarming_task import FlakeSwarmingTask | 16 from model.flake.flake_swarming_task import FlakeSwarmingTask |
| 16 from model.flake.master_flake_analysis import MasterFlakeAnalysis | 17 from model.flake.master_flake_analysis import MasterFlakeAnalysis |
| 17 from waterfall import waterfall_config | 18 from waterfall import waterfall_config |
| 19 from waterfall.post_comment_to_bug_pipeline import PostCommentToBugPipeline | |
| 18 from waterfall.process_flake_swarming_task_result_pipeline import ( | 20 from waterfall.process_flake_swarming_task_result_pipeline import ( |
| 19 ProcessFlakeSwarmingTaskResultPipeline) | 21 ProcessFlakeSwarmingTaskResultPipeline) |
| 20 from waterfall.trigger_flake_swarming_task_pipeline import ( | 22 from waterfall.trigger_flake_swarming_task_pipeline import ( |
| 21 TriggerFlakeSwarmingTaskPipeline) | 23 TriggerFlakeSwarmingTaskPipeline) |
| 22 | 24 |
| 23 | 25 |
| 26 def _UpdateBugWithResult(analysis, queue_name): | |
| 27 """Updates attached bug for the flakiness trend.""" | |
| 28 if not analysis.bug_id: | |
| 29 return False | |
| 30 | |
| 31 comment = textwrap.dedent(""" | |
| 32 Findit has generated the flakiness trend for this flake in the config | |
| 33 "%s / %s / %s" by rerun against build artifacts from Waterfall. Please visit | |
|
lijeffrey
2016/10/21 17:10:27
nit: by rerunning
Also do we want to mention swar
stgao
2016/10/21 22:42:34
Done.
| |
| 34 https://findit-for-me.appspot.com/waterfall/check-flake?key=%s\n | |
| 35 Automatically posted by the findit-for-me app. | |
|
lijeffrey
2016/10/21 17:10:27
nit: should we add the go/findit-site link after f
stgao
2016/10/21 22:42:34
Good idea. But go with a public short link https:/
| |
| 36 Feedback are welcome in Tools>Test>FindIt>Flakiness!""") % ( | |
|
chanli
2016/10/21 23:23:08
Nit: using component Tools>Test>FindIt>Flakiness?
stgao
2016/10/22 00:15:09
Done.
| |
| 37 analysis.original_master_name, analysis.original_builder_name, | |
| 38 analysis.original_step_name, analysis.key.urlsafe()) | |
| 39 labels = ['AnalyzedByFindit'] | |
| 40 pipeline = PostCommentToBugPipeline( | |
| 41 analysis.bug_id, comment, labels) | |
| 42 pipeline.target = appengine_util.GetTargetNameForModule( | |
| 43 constants.WATERFALL_BACKEND) | |
| 44 pipeline.start(queue_name=queue_name) | |
| 45 return True | |
| 46 | |
| 47 | |
| 24 def _UpdateAnalysisStatusUponCompletion(master_flake_analysis, status, error): | 48 def _UpdateAnalysisStatusUponCompletion(master_flake_analysis, status, error): |
| 25 master_flake_analysis.end_time = time_util.GetUTCNow() | 49 master_flake_analysis.end_time = time_util.GetUTCNow() |
| 26 master_flake_analysis.status = status | 50 master_flake_analysis.status = status |
| 27 | 51 |
| 28 if error: | 52 if error: |
| 29 master_flake_analysis.error = error | 53 master_flake_analysis.error = error |
| 30 | 54 |
| 31 master_flake_analysis.put() | 55 master_flake_analysis.put() |
| 32 | 56 |
| 33 | 57 |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 271 flakiness_algorithm_results_dict=flakiness_algorithm_results_dict, | 295 flakiness_algorithm_results_dict=flakiness_algorithm_results_dict, |
| 272 manually_triggered=manually_triggered) | 296 manually_triggered=manually_triggered) |
| 273 # pylint: disable=W0201 | 297 # pylint: disable=W0201 |
| 274 pipeline_job.target = appengine_util.GetTargetNameForModule( | 298 pipeline_job.target = appengine_util.GetTargetNameForModule( |
| 275 constants.WATERFALL_BACKEND) | 299 constants.WATERFALL_BACKEND) |
| 276 pipeline_job.StartOffPSTPeakHours( | 300 pipeline_job.StartOffPSTPeakHours( |
| 277 queue_name=self.queue_name or constants.DEFAULT_QUEUE) | 301 queue_name=self.queue_name or constants.DEFAULT_QUEUE) |
| 278 else: | 302 else: |
| 279 _UpdateAnalysisStatusUponCompletion( | 303 _UpdateAnalysisStatusUponCompletion( |
| 280 master_flake_analysis, analysis_status.COMPLETED, None) | 304 master_flake_analysis, analysis_status.COMPLETED, None) |
| 305 _UpdateBugWithResult( | |
| 306 master_flake_analysis, self.queue_name or constants.DEFAULT_QUEUE) | |
| OLD | NEW |