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

Unified Diff: appengine/findit/waterfall/send_notification_for_culprit_pipeline.py

Issue 2302223002: [Findit] Change the criteria of sending notification to code review. (Closed)
Patch Set: Address comments Created 4 years, 3 months 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 side-by-side diff with in-line comments
Download patch
Index: appengine/findit/waterfall/send_notification_for_culprit_pipeline.py
diff --git a/appengine/findit/waterfall/send_notification_for_culprit_pipeline.py b/appengine/findit/waterfall/send_notification_for_culprit_pipeline.py
index 5f40f4a3996ffae07e88c67d2ea99d88d7b3f3bc..5b395e68df0e8f31a1f32a23eddf3912c9be0167 100644
--- a/appengine/findit/waterfall/send_notification_for_culprit_pipeline.py
+++ b/appengine/findit/waterfall/send_notification_for_culprit_pipeline.py
@@ -14,15 +14,20 @@ from common.http_client_appengine import HttpClientAppengine as HttpClient
from common.pipeline_wrapper import BasePipeline
from common.rietveld import Rietveld
from model import analysis_status as status
+from model.wf_analysis import WfAnalysis
from model.wf_culprit import WfCulprit
from waterfall import build_util
from waterfall import waterfall_config
+def _NotPassAdditionalCriteria(additional_criteria):
+ return additional_criteria['time_limit_passed']
Sharu Jiang 2016/09/02 18:00:22 We can generalize it to: not_pass = True for crite
chanli 2016/09/02 18:25:59 Done.
+
+
@ndb.transactional
def _ShouldSendNotification(
master_name, builder_name, build_number, repo_name, revision,
- commit_position, build_num_threshold, time_limit_passed):
+ commit_position, additional_criteria):
"""Returns True if a notification for the culprit should be sent."""
culprit = (WfCulprit.Get(repo_name, revision) or
WfCulprit.Create(repo_name, revision, commit_position))
@@ -32,14 +37,11 @@ def _ShouldSendNotification(
culprit.builds.append([master_name, builder_name, build_number])
# Send notification only when:
# 1. It was not processed yet.
- # 2. The culprit is for multiple failures in different builds to avoid false
- # positive due to flakiness.
- # 3. It is not too late after the culprit was committed.
+ # 2. It is not too late after the culprit was committed.
# * Try-job takes too long to complete and the failure got fixed.
# * The whole analysis was rerun a long time after the failure occurred.
should_send = not (culprit.cr_notification_processed or
- len(culprit.builds) < build_num_threshold or
- time_limit_passed)
+ _NotPassAdditionalCriteria(additional_criteria))
if should_send:
culprit.cr_notification_status = status.RUNNING
culprit.put()
@@ -98,8 +100,6 @@ class SendNotificationForCulpritPipeline(BasePipeline):
def run(self, master_name, builder_name, build_number, repo_name, revision):
action_settings = waterfall_config.GetActionSettings()
# Set some impossible default values to prevent notification by default.
- build_threshold = action_settings.get(
- 'cr_notification_build_threshold', 100000)
latency_limit_minutes = action_settings.get(
'cr_notification_latency_limit_minutes', 1)
@@ -110,9 +110,17 @@ class SendNotificationForCulpritPipeline(BasePipeline):
time_limit_passed = _NotificationTimeLimitPassed(
build_end_time, latency_limit_minutes)
+ # Additional criteria that will help decide if a notification
+ # should be sent.
+ # TODO (chanli): Add check for if confidence for the culprit is
+ # over threshold.
+ additional_criteria = {
+ 'time_limit_passed': time_limit_passed
+ }
+
if not _ShouldSendNotification(
master_name, builder_name, build_number, repo_name,
- revision, commit_position, build_threshold, time_limit_passed):
+ revision, commit_position, additional_criteria):
return False
return _SendNotificationForCulprit(
repo_name, revision, commit_position, code_review_url)

Powered by Google App Engine
This is Rietveld 408576698