From: commit-bot@chromium.org Date: Thu, 20 Mar 2014 18:31:00 +0000 (+0000) Subject: rebaseline_server: when first started, tell client results are still being generated X-Git-Tag: accepted/tizen/5.0/unified/20181102.025319~8582 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=736be3527214ddbd3dd7e42a89a374c62d98f370;p=platform%2Fupstream%2FlibSkiaSharp.git rebaseline_server: when first started, tell client results are still being generated (SkipBuildbotRuns) NOTREECHECKS=True NOTRY=True R=senorblanco@google.com, senorblanco@chromium.org Author: epoger@google.com Review URL: https://codereview.chromium.org/206723002 git-svn-id: http://skia.googlecode.com/svn/trunk@13879 2bbb7eff-a529-9590-31e7-b0007b416f81 --- diff --git a/gm/rebaseline_server/server.py b/gm/rebaseline_server/server.py index 1ca5757..d88d399 100755 --- a/gm/rebaseline_server/server.py +++ b/gm/rebaseline_server/server.py @@ -87,6 +87,11 @@ RELOAD_INTERVAL_UNTIL_READY = 10 _HTTP_HEADER_CONTENT_LENGTH = 'Content-Length' _HTTP_HEADER_CONTENT_TYPE = 'Content-Type' +SUMMARY_TYPES = [ + results_mod.KEY__HEADER__RESULTS_ALL, + results_mod.KEY__HEADER__RESULTS_FAILURES, +] + _SERVER = None # This gets filled in by main() @@ -172,6 +177,25 @@ class Server(object): self._actuals_repo = _create_svn_checkout( dir_path=actuals_dir, repo_url=actuals_repo_url) + # Since we don't have any results ready yet, prepare a dummy results file + # telling any clients that we're still working on the results. + response_dict = { + results_mod.KEY__HEADER: { + results_mod.KEY__HEADER__SCHEMA_VERSION: ( + results_mod.REBASELINE_SERVER_SCHEMA_VERSION_NUMBER), + results_mod.KEY__HEADER__IS_STILL_LOADING: True, + results_mod.KEY__HEADER__TIME_UPDATED: 0, + results_mod.KEY__HEADER__TIME_NEXT_UPDATE_AVAILABLE: ( + RELOAD_INTERVAL_UNTIL_READY), + }, + } + if not os.path.isdir(GENERATED_JSON_DIR): + os.makedirs(GENERATED_JSON_DIR) + for summary_type in SUMMARY_TYPES: + gm_json.WriteToFile( + response_dict, + os.path.join(GENERATED_JSON_DIR, '%s.json' % summary_type)) + # Reentrant lock that must be held whenever updating EITHER of: # 1. self._results # 2. the expected or actual results on local disk @@ -246,10 +270,10 @@ class Server(object): generated_images_root=GENERATED_IMAGES_DIR, diff_base_url=os.path.relpath( GENERATED_IMAGES_DIR, GENERATED_JSON_DIR)) + if not os.path.isdir(GENERATED_JSON_DIR): os.makedirs(GENERATED_JSON_DIR) - for summary_type in [results_mod.KEY__HEADER__RESULTS_ALL, - results_mod.KEY__HEADER__RESULTS_FAILURES]: + for summary_type in SUMMARY_TYPES: gm_json.WriteToFile( new_results.get_packaged_results_of_type(results_type=summary_type), os.path.join(GENERATED_JSON_DIR, '%s.json' % summary_type))