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

Unified Diff: scripts/slave/chromium/archive_layout_test_retry_summary.py

Issue 2421733002: Archive retry summary for layout tests along with layout test results. (Closed)
Patch Set: build_number -> options.build_number Created 4 years, 2 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: scripts/slave/chromium/archive_layout_test_retry_summary.py
diff --git a/scripts/slave/chromium/archive_layout_test_retry_summary.py b/scripts/slave/chromium/archive_layout_test_retry_summary.py
new file mode 100755
index 0000000000000000000000000000000000000000..1265f818927e3765f01e21244d7b41cf9a6de840
--- /dev/null
+++ b/scripts/slave/chromium/archive_layout_test_retry_summary.py
@@ -0,0 +1,73 @@
+#!/usr/bin/env python
+# Copyright 2016 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.
+
+"""This script is intended to archive retry summary results from
+try bot retries for layout tests along with layout test results.
+
+The purpose if this is so that these retry results can be fetched
+from the same place that the first run results are fetched.
+"""
+
+import logging
+import argparse
+import os
+import re
+import socket
+import sys
+
+from slave import slave_utils
+
+
+def ArchiveRetrySummary(options):
+ print 'Staging in %s' % options.staging_dir
+ if not os.path.exists(options.staging_dir):
+ os.makedirs(options.staging_dir)
+
+ retry_summary_file = os.path.join(options.staging_dir, 'retry-summary.json')
+ with open(retry_summary_file, 'w') as f:
+ f.write(options.retry_summary)
+
+ options.builder_name = re.sub('[ .()]', '_', options.builder_name)
+
+ print 'Builder name: %s' % options.builder_name
+ print 'Build number: %s' % options.build_number
+ print 'Host name: %s' % socket.gethostname()
+
+ # Copy the results to a directory archived by build number.
+ gs_base = '/'.join(
+ [options.gs_bucket, options.builder_name, options.build_number])
+
+ # This file should never change; cache for a year.
+ cache_control = "public, max-age=31556926"
+
+ slave_utils.GSUtilCopyFile(retry_summary_file,
+ gs_base,
+ cache_control=cache_control)
+ return 0
+
+
+def _ParseOptions():
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--retry-summary', type=str, required=True,
+ help='retry summary as JSON')
+ parser.add_argument('--builder-name', type=str, required=True)
+ parser.add_argument('--build-number', type=str, required=True)
+ parser.add_argument('--gs-bucket', type=str, required=True)
+ parser.add_argument('--staging-dir', type=str, required=True,
+ help='directory to write temp files to')
+ return parser.parse_args()
+
+
+def main():
+ options = _ParseOptions()
+ logging.basicConfig(level=logging.INFO,
+ format='%(asctime)s %(filename)s:%(lineno)-3d'
+ ' %(levelname)s %(message)s',
+ datefmt='%y%m%d %H:%M:%S')
+ return ArchiveRetrySummary(options)
+
+
+if '__main__' == __name__:
+ sys.exit(main())
« no previous file with comments | « no previous file | scripts/slave/recipe_modules/test_utils/__init__.py » ('j') | scripts/slave/recipe_modules/test_utils/api.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698