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

Unified Diff: gm/rebaseline_server/server.py

Issue 117453002: rebaseline_server: return rebaseline results faster, and reload UI page automatically after (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 7 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
« no previous file with comments | « no previous file | gm/rebaseline_server/static/loader.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/rebaseline_server/server.py
diff --git a/gm/rebaseline_server/server.py b/gm/rebaseline_server/server.py
index e8dbb6be732a338ec9f83015b7d2b090ee3857e1..d1d9c855afc3fe5d7f56f5be1cfd3e2a4e43c273 100755
--- a/gm/rebaseline_server/server.py
+++ b/gm/rebaseline_server/server.py
@@ -157,8 +157,8 @@ class Server(object):
@property
def results(self):
- """ Returns the most recently generated results, or None if update_results()
- has not been called yet. """
+ """ Returns the most recently generated results, or None if we don't have
+ any valid results (update_results() has not completed yet). """
return self._results
@property
@@ -178,15 +178,22 @@ class Server(object):
results. """
return self._reload_seconds
- def update_results(self):
+ def update_results(self, invalidate=False):
""" Create or update self._results, based on the expectations in
EXPECTATIONS_DIR and the latest actuals from skia-autogen.
We hold self.results_rlock while we do this, to guarantee that no other
thread attempts to update either self._results or the underlying files at
the same time.
+
+ Args:
+ invalidate: if True, invalidate self._results immediately upon entry;
+ otherwise, we will let readers see those results until we
+ replace them
"""
with self.results_rlock:
+ if invalidate:
+ self._results = None
logging.info('Updating actual GM results in %s from SVN repo %s ...' % (
self._actuals_dir, ACTUALS_SVN_REPO))
self._actuals_repo.Update('.')
@@ -445,8 +452,11 @@ class HTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
'results and submit the modifications again.' %
oldResultsType)
_SERVER.results.edit_expectations(data['modifications'])
- # Read the updated results back from disk.
- _SERVER.update_results()
+
+ # Read the updated results back from disk.
+ # We can do this in a separate thread; we should return our success message
+ # to the UI as soon as possible.
+ thread.start_new_thread(_SERVER.update_results, (True,))
def redirect_to(self, url):
""" Redirect the HTTP client to a different url.
« no previous file with comments | « no previous file | gm/rebaseline_server/static/loader.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698