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

Unified Diff: appengine/findit/handlers/flake/check_flake.py

Issue 2131473003: UI for the regression range test. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 4 years, 5 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/handlers/flake/check_flake.py
diff --git a/appengine/findit/handlers/flake/check_flake.py b/appengine/findit/handlers/flake/check_flake.py
index 9cbfe9ee8818f968768e81d4e3a4ab41e434ea6d..e93654b44737f9149095fc497290f4e9993a0653 100644
--- a/appengine/findit/handlers/flake/check_flake.py
+++ b/appengine/findit/handlers/flake/check_flake.py
@@ -2,8 +2,15 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+from google.appengine.api import users
+
+from common import constants
from common.base_handler import BaseHandler
from common.base_handler import Permission
+from model import analysis_status
+from model.flake.master_flake_analysis import MasterFlakeAnalysis
+from waterfall.flake.initialize_flake_pipeline import ScheduleAnalysisIfNeeded
+
class CheckFlake(BaseHandler):
@@ -16,19 +23,47 @@ class CheckFlake(BaseHandler):
master_name = self.request.get('master_name').strip()
builder_name = self.request.get('builder_name').strip()
build_number = int(self.request.get('build_number').strip())
- test_target_name = self.request.get('test_target_name').strip()
+ step_name = self.request.get('test_target_name').strip()
testcase = self.request.get('testcase').strip()
- # TODO(caiw): Get status of master_analysis from database.
-
- # TODO(caiw): If there is a completed master_analysis, return
- # the template which displays it.
-
- # TODO(caiw): If the current master_analysis has an error,
- # delete it.
-
- # TODO(caiw): If there is no master_analysis, create one.
-
- # TODO(caiw): Trigger pipeline.
+ # Get status of master_analysis from database.
+ analysis = MasterFlakeAnalysis.Get(master_name, builder_name, step_name)
stgao 2016/07/09 00:12:24 Should we use the one returned by ScheduleAnalysis
caiw 2016/07/14 00:59:34 Done.
+ force = (users.is_current_user_admin() and
+ self.request.get('force') == '1')
+ # Disable for testing - pylint: disable=W0105
+ """
+ # If there is an existing one, react appropriately
+ if analysis:
+ if (analysis.status == analysis_status.COMPLETED or
+ analysis.status == analysis_status.RUNNING):
+ return {
+ 'template': 'flake/finished_analysis.html',
+ 'data': analysis.GenerateData(),
+ }
+ elif analysis.status == analysis_status.PENDING:
+ print "wtf\n\n"
+ return {
+ 'template': 'flake/in_progress.html'
+ }
+ elif analysis.status == analysis_status.ERROR:
+ # If the current master_analysis has an error,
+ # delete it.
+ if force:
+ # Delete analysis (but not yet)
+ pass
+ else:
+ # Return error template
+ return {
+ 'template': 'flake/error.html',
+ }
- # TODO(caiw): Return the appropriate template based on the case.
+ force = (users.is_current_user_admin() and
+ self.request.get('force') == '1')
+ """
+ # Do we need a put() statement?
+ ScheduleAnalysisIfNeeded(master_name, builder_name, step_name,
+ build_number, testcase, force=force,
+ queue_name=constants.WATERFALL_ANALYSIS_QUEUE)
+ return {
+ 'template': 'flake/in_progress.html'
+ }
« no previous file with comments | « no previous file | appengine/findit/templates/flake/error.html » ('j') | appengine/findit/templates/flake/error.html » ('J')

Powered by Google App Engine
This is Rietveld 408576698