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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright 2016 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 """This script is intended to archive retry summary results from
7 try bot retries for layout tests along with layout test results.
8
9 The purpose if this is so that these retry results can be fetched
10 from the same place that the first run results are fetched.
11 """
12
13 import logging
14 import argparse
15 import os
16 import re
17 import socket
18 import sys
19
20 from slave import slave_utils
21
22
23 def ArchiveRetrySummary(options):
24 print 'Staging in %s' % options.staging_dir
25 if not os.path.exists(options.staging_dir):
26 os.makedirs(options.staging_dir)
27
28 retry_summary_file = os.path.join(options.staging_dir, 'retry-summary.json')
29 with open(retry_summary_file, 'w') as f:
30 f.write(options.retry_summary)
31
32 options.builder_name = re.sub('[ .()]', '_', options.builder_name)
33
34 print 'Builder name: %s' % options.builder_name
35 print 'Build number: %s' % options.build_number
36 print 'Host name: %s' % socket.gethostname()
37
38 # Copy the results to a directory archived by build number.
39 gs_base = '/'.join(
40 [options.gs_bucket, options.builder_name, options.build_number])
41
42 # This file should never change; cache for a year.
43 cache_control = "public, max-age=31556926"
44
45 slave_utils.GSUtilCopyFile(retry_summary_file,
46 gs_base,
47 cache_control=cache_control)
48 return 0
49
50
51 def _ParseOptions():
52 parser = argparse.ArgumentParser()
53 parser.add_argument('--retry-summary', type=str, required=True,
54 help='retry summary as JSON')
55 parser.add_argument('--builder-name', type=str, required=True)
56 parser.add_argument('--build-number', type=str, required=True)
57 parser.add_argument('--gs-bucket', type=str, required=True)
58 parser.add_argument('--staging-dir', type=str, required=True,
59 help='directory to write temp files to')
60 return parser.parse_args()
61
62
63 def main():
64 options = _ParseOptions()
65 logging.basicConfig(level=logging.INFO,
66 format='%(asctime)s %(filename)s:%(lineno)-3d'
67 ' %(levelname)s %(message)s',
68 datefmt='%y%m%d %H:%M:%S')
69 return ArchiveRetrySummary(options)
70
71
72 if '__main__' == __name__:
73 sys.exit(main())
OLDNEW
« 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