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

Unified Diff: appengine/findit/waterfall/flake/initialize_flake_pipeline.py

Issue 2411893002: [Findit] Adding metadata for manually vs automatically triggered flake analyses (Closed)
Patch Set: Created 4 years, 2 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/flake/initialize_flake_pipeline.py
diff --git a/appengine/findit/waterfall/flake/initialize_flake_pipeline.py b/appengine/findit/waterfall/flake/initialize_flake_pipeline.py
index 797e602abe283a720790b2cf24808c3fb2928085..7a9d50ff2a9dd8ec6d2209ed0594b9b06cf50c3c 100644
--- a/appengine/findit/waterfall/flake/initialize_flake_pipeline.py
+++ b/appengine/findit/waterfall/flake/initialize_flake_pipeline.py
@@ -10,12 +10,14 @@ from common import time_util
from model import analysis_status
from model.flake.master_flake_analysis import MasterFlakeAnalysis
from waterfall import waterfall_config
+from waterfall.flake import triggering_sources
from waterfall.flake.recursive_flake_pipeline import RecursiveFlakePipeline
def _NeedANewAnalysis(
master_name, builder_name, build_number, step_name, test_name,
- algorithm_parameters, allow_new_analysis=False, force=False):
+ algorithm_parameters, allow_new_analysis=False, force=False,
+ user_email='', triggering_source=triggering_sources.FINDIT):
"""Checks status of analysis for the test and decides if a new one is needed.
A MasterFlakeAnalysis entity for the given parameters will be created if none
@@ -30,6 +32,8 @@ def _NeedANewAnalysis(
test_name (str): The flaky test to be analyzed.
allow_new_analysis (bool): Indicate whether a new analysis is allowed.
force (bool): Indicate whether to force a rerun of current analysis.
+ user_email (str): The user triggering this analysis.
+ triggering_source (int): The source from which this analysis was triggered.
Returns:
(need_new_analysis, analysis)
@@ -48,6 +52,8 @@ def _NeedANewAnalysis(
analysis.status = analysis_status.PENDING
analysis.algorithm_parameters = algorithm_parameters
analysis.version = appengine_util.GetCurrentVersion()
+ analysis.triggering_user_email = user_email
+ analysis.triggering_source = triggering_source
_, saved = analysis.Save()
return saved, analysis
elif (analysis.status == analysis_status.PENDING or
@@ -60,6 +66,8 @@ def _NeedANewAnalysis(
analysis.status = analysis_status.PENDING
analysis.algorithm_parameters = algorithm_parameters
analysis.version = appengine_util.GetCurrentVersion()
+ analysis.triggering_user_email = user_email
+ analysis.triggering_source = triggering_source
_, saved = analysis.Save()
return saved, analysis
else:
@@ -68,7 +76,8 @@ def _NeedANewAnalysis(
def ScheduleAnalysisIfNeeded(master_name, builder_name, build_number, step_name,
test_name, allow_new_analysis=False, force=False,
- manually_triggered=False,
+ user_email='',
+ triggering_source=triggering_sources.FINDIT,
queue_name=constants.DEFAULT_QUEUE):
"""Schedules an analysis if needed and returns the MasterFlakeAnalysis.
@@ -83,8 +92,9 @@ def ScheduleAnalysisIfNeeded(master_name, builder_name, build_number, step_name,
test_name (str): The single test we are checking
allow_new_analysis (bool): Indicate whether a new analysis is allowed.
force (bool): Indicate whether to force a rerun of current analysis.
- manually_triggered (bool): True if the analysis is from manual request, like
- by a Chromium sheriff.
+ user_email (str): The email of the user requesting the analysis.
+ triggering_source (int): From where this analysis was triggered, such as
+ through Findit itself or through Findit API.
queue_name (str): The App Engine queue to run the analysis.
Returns:
@@ -95,7 +105,8 @@ def ScheduleAnalysisIfNeeded(master_name, builder_name, build_number, step_name,
need_new_analysis, analysis = _NeedANewAnalysis(
master_name, builder_name, build_number, step_name, test_name,
- algorithm_parameters, allow_new_analysis, force)
+ algorithm_parameters, allow_new_analysis, force,
+ user_email, triggering_source)
if need_new_analysis:
# _NeedANewAnalysis just created master_flake_analysis. Use the latest
@@ -121,6 +132,8 @@ def ScheduleAnalysisIfNeeded(master_name, builder_name, build_number, step_name,
'sequential_run_index': 0
}
+ manually_triggered = user_email.endswith('@google.com')
stgao 2016/10/13 06:14:38 Not sure if it is a good idea to add this logic de
lijeffrey 2016/10/14 23:45:21 Done. Changed it back to accept manually_triggered
+
pipeline_job = RecursiveFlakePipeline(
master_name, builder_name, build_number, step_name, test_name,
analysis.version_number, master_build_number=build_number,

Powered by Google App Engine
This is Rietveld 408576698