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

Unified Diff: appengine/findit/util_scripts/crash_queries/delta_test/delta_test.py

Issue 2432203003: [Predator] Run predator. (Closed)
Patch Set: Fix nits. Created 4 years, 1 month 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/util_scripts/crash_queries/delta_test/delta_test.py
diff --git a/appengine/findit/util_scripts/crash_queries/delta_test/delta_test.py b/appengine/findit/util_scripts/crash_queries/delta_test/delta_test.py
index f03f8cc70317e2198cd67075abc12ab8e5535a85..ab6437661ad3f77bea4ff895432e6a6f6b161af9 100644
--- a/appengine/findit/util_scripts/crash_queries/delta_test/delta_test.py
+++ b/appengine/findit/util_scripts/crash_queries/delta_test/delta_test.py
@@ -11,9 +11,12 @@ import subprocess
from crash_queries import crash_iterator
from crash_queries.delta_test import delta_util
-AZALEA_RESULTS_DIRECTORY = os.path.join(os.path.dirname(__file__),
- 'azalea_results')
+PREDATOR_RESULTS_DIRECTORY = os.path.join(os.path.dirname(__file__),
+ 'predator_results')
DELTA_TEST_DIRECTORY = os.path.dirname(__file__)
+CRASH_FIELDS = ['crashed_version', 'stack_trace', 'signature',
+ 'platform', 'client_id', 'regression_range',
+ 'customized_data', 'historical_metadata']
# TODO(crbug.com/662540): Add unittests.
@@ -98,7 +101,14 @@ def GetDeltasFromTwoSetsOfResults(set1, set2): # pragma: no cover.
continue
result2 = set2[result_id]
- delta = Delta(result1, result2, result1.fields)
+ if result1:
+ fields = result1.fields
+ elif result2:
+ fields = result2.fields
+ else:
+ fields = None
+
+ delta = Delta(result1, result2, fields)
if delta:
deltas[result_id] = delta
@@ -106,13 +116,14 @@ def GetDeltasFromTwoSetsOfResults(set1, set2): # pragma: no cover.
# TODO(crbug.com/662540): Add unittests.
-def GetResults(crashes, client_id, git_hash, result_path,
+def GetResults(crashes, client_id, app_id, git_hash, result_path,
verbose=False): # pragma: no cover.
"""Returns an evaluator function to compute delta between 2 findit githashes.
Args:
crashes (list): A list of crash infos.
client_id (str): Possible values - fracas/cracas/clustefuzz.
+ app_id (str): Appengine app id to query.
git_hash (str): A git hash of findit repository.
result_path (str): file path for subprocess to write results on.
verbose (bool): If True, print all the findit results.
@@ -125,7 +136,7 @@ def GetResults(crashes, client_id, git_hash, result_path,
return {}
if verbose:
- logging.info('\n\n***************************')
+ logging.info('***************************')
logging.info('Switching to git %s', git_hash)
logging.info('***************************\n\n')
@@ -137,7 +148,7 @@ def GetResults(crashes, client_id, git_hash, result_path,
shell=True)
if not os.path.exists(result_path):
- args = ['python', 'run-predator.py', result_path, '--client', client_id]
+ args = ['python', 'run-predator.py', result_path, client_id, app_id]
if verbose:
args.append('--verbose')
p = subprocess.Popen(args, stdin=subprocess.PIPE)
@@ -190,6 +201,7 @@ def DeltaEvaluator(git_hash1, git_hash2,
crash_count = 0
for index, crashes in enumerate(
crash_iterator.IterateCrashes(client_id, app_id,
+ fields=CRASH_FIELDS,
property_values=property_values,
start_date=start_date,
end_date=end_date,
@@ -199,15 +211,18 @@ def DeltaEvaluator(git_hash1, git_hash2,
results = []
for git_hash in [git_hash1, git_hash2]:
result_path = os.path.join(
- AZALEA_RESULTS_DIRECTORY, delta_util.GenerateFileName(
+ PREDATOR_RESULTS_DIRECTORY, delta_util.GenerateFileName(
client_id, property_values, start_date, end_date,
batch_size, index, git_hash))
- results.append(GetResults(crashes, client_id, git_hash, result_path,
+ results.append(GetResults(crashes, client_id, app_id,
+ git_hash, result_path,
verbose=verbose))
crash_count += len(crashes)
- deltas.update(GetDeltasFromTwoSetsOfResults(*results))
-
+ batch_deltas = GetDeltasFromTwoSetsOfResults(*results)
+ # Print deltas of the current batch.
+ delta_util.PrintDelta(batch_deltas, len(crashes))
+ deltas.update(batch_deltas)
return deltas, crash_count
finally:
with open(os.devnull, 'w') as null_handle:

Powered by Google App Engine
This is Rietveld 408576698