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 from datetime import datetime | 5 from datetime import datetime |
6 import logging | 6 import logging |
7 import textwrap | 7 import textwrap |
8 | 8 |
9 from google.appengine.ext import ndb | 9 from google.appengine.ext import ndb |
10 | 10 |
11 from lib.gitiles.gitiles_repository import GitilesRepository | |
stgao
2016/10/28 18:21:00
order of import
wrengr
2016/10/28 19:24:49
Done.
| |
11 from common import time_util | 12 from common import time_util |
12 from common.git_repository import GitRepository | |
13 from common.http_client_appengine import HttpClientAppengine as HttpClient | 13 from common.http_client_appengine import HttpClientAppengine as HttpClient |
14 from common.pipeline_wrapper import BasePipeline | 14 from common.pipeline_wrapper import BasePipeline |
15 from common.rietveld import Rietveld | 15 from common.rietveld import Rietveld |
16 from model import analysis_status as status | 16 from model import analysis_status as status |
17 from model.wf_analysis import WfAnalysis | 17 from model.wf_analysis import WfAnalysis |
18 from model.wf_culprit import WfCulprit | 18 from model.wf_culprit import WfCulprit |
19 from waterfall import build_util | 19 from waterfall import build_util |
20 from waterfall import waterfall_config | 20 from waterfall import waterfall_config |
21 | 21 |
22 | 22 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
85 | 85 |
86 _UpdateNotificationStatus(repo_name, revision, | 86 _UpdateNotificationStatus(repo_name, revision, |
87 status.COMPLETED if sent else status.ERROR) | 87 status.COMPLETED if sent else status.ERROR) |
88 return sent | 88 return sent |
89 | 89 |
90 | 90 |
91 def _GetCulpritInfo(repo_name, revision): | 91 def _GetCulpritInfo(repo_name, revision): |
92 """Returns commit position/time and code-review url of the given revision.""" | 92 """Returns commit position/time and code-review url of the given revision.""" |
93 # TODO(stgao): get repo url at runtime based on the given repo name. | 93 # TODO(stgao): get repo url at runtime based on the given repo name. |
94 # unused arg - pylint: disable=W0612,W0613 | 94 # unused arg - pylint: disable=W0612,W0613 |
95 repo = GitRepository( | 95 repo = GitilesRepository( |
96 'https://chromium.googlesource.com/chromium/src.git', HttpClient()) | 96 'https://chromium.googlesource.com/chromium/src.git', HttpClient()) |
97 change_log = repo.GetChangeLog(revision) | 97 change_log = repo.GetChangeLog(revision) |
98 return change_log.commit_position, change_log.code_review_url | 98 return change_log.commit_position, change_log.code_review_url |
99 | 99 |
100 | 100 |
101 def _WithinNotificationTimeLimit(build_end_time, latency_limit_minutes): | 101 def _WithinNotificationTimeLimit(build_end_time, latency_limit_minutes): |
102 """Returns True if it is still in time to send notification.""" | 102 """Returns True if it is still in time to send notification.""" |
103 latency_seconds = (time_util.GetUTCNow() - build_end_time).total_seconds() | 103 latency_seconds = (time_util.GetUTCNow() - build_end_time).total_seconds() |
104 return latency_seconds <= latency_limit_minutes * 60 | 104 return latency_seconds <= latency_limit_minutes * 60 |
105 | 105 |
(...skipping 26 matching lines...) Expand all Loading... | |
132 'within_time_limit': within_time_limit | 132 'within_time_limit': within_time_limit |
133 } | 133 } |
134 | 134 |
135 if not _ShouldSendNotification( | 135 if not _ShouldSendNotification( |
136 master_name, builder_name, build_number, repo_name, | 136 master_name, builder_name, build_number, repo_name, |
137 revision, commit_position, build_num_threshold, additional_criteria, | 137 revision, commit_position, build_num_threshold, additional_criteria, |
138 send_notification_right_now): | 138 send_notification_right_now): |
139 return False | 139 return False |
140 return _SendNotificationForCulprit( | 140 return _SendNotificationForCulprit( |
141 repo_name, revision, commit_position, code_review_url) | 141 repo_name, revision, commit_position, code_review_url) |
OLD | NEW |