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

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

Issue 1149743002: [Findit] Use step level analysis to exclude flaky test failures. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Use cStringIO to pull the reliable test failures. Created 5 years, 7 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/buildbot.py
diff --git a/appengine/findit/waterfall/buildbot.py b/appengine/findit/waterfall/buildbot.py
index 28d39db4ab0f9ee9d9348adb02abe0da31398105..1894220da03c255eebabc086aa281c3bc3e94702 100644
--- a/appengine/findit/waterfall/buildbot.py
+++ b/appengine/findit/waterfall/buildbot.py
@@ -2,11 +2,15 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import contextlib
from datetime import datetime
+import gzip
import json
import re
import urllib
+import cloudstorage as gcs
+
from waterfall.build_info import BuildInfo
_MASTER_URL_PATTERN = re.compile(r'^https?://build\.chromium\.org/p/([^/]+)'
@@ -97,7 +101,12 @@ def CreateStdioLogUrl(master_name, builder_name, build_number, step_name):
master_name, builder_name, build_number, step_name)
-def GetBuildDataFromBuildMaster(master_name,
+def CreateGtestResultPath(master_name, builder_name, build_number, step_name):
+ return ('/chrome-gtest-results/buildbot/%s/%s/%s/%s.json.gz') % (
+ master_name, builder_name, build_number, step_name)
+
+
+def GetBuildDataFromBuildMaster(master_name,
builder_name, build_number, http_client):
"""Returns the json-format data of the build from buildbot json API."""
status_code, data = http_client.Get(
@@ -108,7 +117,7 @@ def GetBuildDataFromBuildMaster(master_name,
return data
-def GetBuildDataFromArchive(master_name,
+def GetBuildDataFromArchive(master_name,
builder_name, build_number, http_client):
"""Returns the json-format data of the build from build archive."""
status_code, data = http_client.Get(
@@ -130,6 +139,20 @@ def GetStepStdio(master_name, builder_name, build_number,
return data
+def GetGtestResultLog(master_name,
+ builder_name, build_number, step_name): # pragma: no cover
+ """Returns the archived Step Log file."""
stgao 2015/05/22 01:30:36 This function is to return the content of the gtes
+ try:
+ with contextlib.closing(gcs.open(CreateGtestResultPath(
+ master_name, builder_name,
+ build_number, step_name))) as gtest_result_file:
+ with contextlib.closing(gzip.open(
+ gtest_result_file)) as unzipped_gtest_result_file:
+ return unzipped_gtest_result_file.read()
+ except gcs.NotFoundError:
+ return None
+
+
def GetStepResult(step_data_json):
"""Returns the result of a step."""
result = step_data_json.get('results')
@@ -184,8 +207,8 @@ def ExtractBuildInfo(master_name, builder_name, build_number, build_data):
for step_data in steps:
step_name = step_data['name']
- step_logs = step_data.get('logs')
- if step_logs and 'preamble' == step_logs[0][0]:
+ gtest_results = step_data.get('logs')
stgao 2015/05/22 01:30:36 This is actually 'step_logs'. Let's keep it as it
+ if gtest_results and 'preamble' == gtest_results[0][0]:
# Skip a annotating step like "steps" or "slave_steps", which wraps other
# steps. A failed annotated step like "content_browsertests" will make
# the annotating step like "steps" fail too. Such annotating steps have a

Powered by Google App Engine
This is Rietveld 408576698