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

Unified Diff: dashboard/dashboard/delete_old_tests.py

Issue 2162963002: [polymer] Merge of master into polymer10-migration (Closed) Base URL: git@github.com:catapult-project/catapult.git@polymer10-migration
Patch Set: Merge polymer10-migration int polymer10-merge 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
« no previous file with comments | « dashboard/dashboard/bisect_fyi_test.py ('k') | dashboard/dashboard/delete_test_data.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dashboard/dashboard/delete_old_tests.py
diff --git a/dashboard/dashboard/delete_old_tests.py b/dashboard/dashboard/delete_old_tests.py
index 3ef7ab087b74c2a09d26736697a77184db18b203..a3704e83c95e3cc1efd1fe4dab9c4be488f0eed7 100644
--- a/dashboard/dashboard/delete_old_tests.py
+++ b/dashboard/dashboard/delete_old_tests.py
@@ -5,6 +5,7 @@
"""A cron job which queues old tests for deletion."""
import datetime
+import logging
from google.appengine.api import taskqueue
from google.appengine.datastore import datastore_query
@@ -26,21 +27,21 @@ _DELETE_TASK_QUEUE_NAME = 'delete-tests-queue'
class DeleteOldTestsHandler(request_handler.RequestHandler):
"""Finds tests with no new data, and deletes them."""
+ def get(self):
+ self.post()
+
def post(self):
"""Query for tests, and put ones with no new data on the delete queue."""
datastore_hooks.SetPrivilegedRequest()
+ logging.info('Cursor: %s', self.request.get('cursor'))
cursor = datastore_query.Cursor(urlsafe=self.request.get('cursor'))
tests, next_cursor, more = graph_data.TestMetadata.query().fetch_page(
_TESTS_TO_CHECK_AT_ONCE, keys_only=True, start_cursor=cursor)
- if more:
- taskqueue.add(
- url='/delete_old_tests',
- params={'cursor': next_cursor.urlsafe()},
- queue_name=_TASK_QUEUE_NAME)
for test in tests:
# Delete this test if:
# 1) It has no Rows newer than the cutoff
# 2) It has no descendant tests
+ logging.info('Checking %s', utils.TestPath(test))
no_new_rows = False
last_row = graph_data.Row.query(
graph_data.Row.parent_test == utils.OldStyleTestKey(test)).order(
@@ -51,8 +52,14 @@ class DeleteOldTestsHandler(request_handler.RequestHandler):
else:
no_new_rows = True
descendants = list_tests.GetTestDescendants(test, keys_only=True)
- descendants.remove(test)
+ if test in descendants:
+ descendants.remove(test)
+ stamp = 'never'
+ if last_row:
+ stamp = last_row.timestamp
if not descendants and no_new_rows:
+ logging.info('Deleting test %s last timestamp %s',
+ utils.TestPath(test), stamp)
taskqueue.add(
url='/delete_test_data',
params={
@@ -60,3 +67,12 @@ class DeleteOldTestsHandler(request_handler.RequestHandler):
'test_key': test.urlsafe(),
},
queue_name=_DELETE_TASK_QUEUE_NAME)
+ else:
+ logging.info('NOT Deleting test %s last timestamp %s',
+ utils.TestPath(test), stamp)
+
+ if more:
+ taskqueue.add(
+ url='/delete_old_tests',
+ params={'cursor': next_cursor.urlsafe()},
+ queue_name=_TASK_QUEUE_NAME)
« no previous file with comments | « dashboard/dashboard/bisect_fyi_test.py ('k') | dashboard/dashboard/delete_test_data.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698