Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Side by Side Diff: appengine/findit/waterfall/send_notification_for_culprit_pipeline.py

Issue 2524633002: [Culprit-Finder] Refactor GitilesRepostory to make http_client required argument. (Closed)
Patch Set: Rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « appengine/findit/waterfall/pull_changelog_pipeline.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 = GitilesRepository( 95 repo = GitilesRepository(
96 'https://chromium.googlesource.com/chromium/src.git', HttpClient()) 96 HttpClient(), 'https://chromium.googlesource.com/chromium/src.git')
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
106 106
(...skipping 25 matching lines...) Expand all
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)
OLDNEW
« no previous file with comments | « appengine/findit/waterfall/pull_changelog_pipeline.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698