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

Unified Diff: appengine_apps/chromium_status/appengine_module/chromium_status/lkgr.py

Issue 778533003: Moved chromium_status to appengine/ (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 6 years 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_apps/chromium_status/appengine_module/chromium_status/lkgr.py
diff --git a/appengine_apps/chromium_status/appengine_module/chromium_status/lkgr.py b/appengine_apps/chromium_status/appengine_module/chromium_status/lkgr.py
deleted file mode 100644
index 31532d74308ac3ef38c66fcb1f32acdcd748f733..0000000000000000000000000000000000000000
--- a/appengine_apps/chromium_status/appengine_module/chromium_status/lkgr.py
+++ /dev/null
@@ -1,107 +0,0 @@
-# Copyright (c) 2011 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""LKGR management webpages."""
-
-import json
-import logging
-
-from google.appengine.ext import db
-
-from appengine_module.chromium_status.base_page import BasePage
-from appengine_module.chromium_status import utils
-
-
-class Revision(db.Model): # pylint: disable=W0232
- """Description for the revisions table."""
- # The revision for which we save a status.
- revision = db.IntegerProperty(required=True)
- # The date when the revision status got added.
- date = db.DateTimeProperty(auto_now_add=True)
- # The success (True)/Failure (False) status of this revision.
- status = db.BooleanProperty(required=True)
- # The steps that caused the failure (if any).
- failed_steps = db.TextProperty()
- # Git hash for this revision
- git_hash = db.StringProperty()
- # Git hash is set
- git_hash_set = db.BooleanProperty(default=False)
-
-
-class Revisions(BasePage):
- """Displays the revisions page containing the last 100 revisions."""
-
- @utils.requires_read_access
- def get(self):
- """Returns information about the last revision status."""
- limit = int(self.request.get('limit', 100))
- revisions = Revision.all().order('-revision').fetch(limit)
- if self.request.get('format') == 'json':
- self.response.headers['Content-Type'] = 'application/json'
- self.response.headers['Access-Control-Allow-Origin'] = '*'
- data = json.dumps([revision.AsDict() for revision in revisions])
- self.response.out.write(data)
- return
-
- page_value = {'revisions': revisions}
- template_values = self.InitializeTemplate('Chromium Revisions Status')
- template_values.update(page_value)
- self.DisplayTemplate('revisions.html', template_values)
-
- @utils.requires_write_access
- def post(self):
- """Adds a new revision status."""
- revision = self.request.get('revision')
- success = self.request.get('success')
- steps = self.request.get('steps')
- git_hash = self.request.get('git_hash')
- if revision and success:
- revision = int(revision)
- obj = Revision.all().filter('revision', revision).get()
- if not obj:
- obj = Revision(revision=revision, status=(success=="1"))
-
- obj.status = (success == "1")
- obj.failed_steps = steps
- if git_hash:
- obj.git_hash = git_hash
- obj.git_hash_set = True
-
- obj.put()
-
-
-class LastKnownGoodRevisionSVN(BasePage):
- """Displays the /lkgr and /svn-lkgr pages."""
-
- @utils.requires_read_access
- def get(self):
- """Look for the latest successful revision and return it."""
- self.response.headers['Cache-Control'] = 'no-cache, private, max-age=5'
- self.response.headers['Content-Type'] = 'text/plain'
- revision = Revision.all().filter('status', True).order('-revision').get()
- if revision:
- self.response.out.write(revision.revision)
-
-
-class LastKnownGoodRevisionGIT(BasePage):
- """Displays the /git-lkgr page."""
-
- @utils.requires_read_access
- def get(self):
- """Look for the latest successful revision and return it."""
- self.response.headers['Cache-Control'] = 'no-cache, private, max-age=5'
- self.response.headers['Content-Type'] = 'text/plain'
- revision = (
- Revision.all().filter('status', True).filter('git_hash_set', True)
- .order('-revision').get() )
- if revision:
- self.response.out.write(revision.git_hash)
- else:
- logging.error('OMG There\'s no git-lkgr!?')
- self.abort(404)
-
-
-def bootstrap():
- if db.GqlQuery('SELECT __key__ FROM Revision').get() is None:
- Revision(revision=0, status=False).put()

Powered by Google App Engine
This is Rietveld 408576698