Chromium Code Reviews| OLD | NEW |
|---|---|
| (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(args): | |
| 24 args.builder_name = re.sub('[ .()]', '_', args.builder_name) | |
| 25 print 'Builder name: %s' % args.builder_name | |
| 26 print 'Build number: %s' % args.build_number | |
| 27 print 'Host name: %s' % socket.gethostname() | |
| 28 | |
| 29 gs_base = '/'.join([args.gs_bucket, args.builder_name, args.build_number]) | |
| 30 slave_utils.GSUtilCopyFile(args.retry_summary_json, | |
| 31 gs_base, | |
| 32 cache_control="public, max-age=31556926") | |
| 33 slave_utils.GSUtilMoveFile(os.path.join(gs_base, args.retry_summary_json), | |
| 34 os.path.join(gs_base, 'retry_summary.json')) | |
|
qyearsley
2016/10/17 20:21:46
Alternately, instead of moving it after uploading,
Dirk Pranke
2016/10/17 21:29:26
Why are you moving instead of copying? I would be
qyearsley
2016/10/17 21:43:52
The reason for renaming the file here is that the
Dirk Pranke
2016/10/17 21:55:33
Oh, sorry, I misread this and you're copying it to
| |
| 35 return 0 | |
| 36 | |
| 37 | |
| 38 def _ParseArgs(): | |
| 39 parser = argparse.ArgumentParser() | |
| 40 parser.add_argument('--retry-summary-json', type=str, required=True, | |
| 41 help='path to retry summary JSON file') | |
| 42 parser.add_argument('--builder-name', type=str, required=True) | |
| 43 parser.add_argument('--build-number', type=str, required=True) | |
| 44 parser.add_argument('--gs-bucket', type=str, required=True) | |
| 45 return parser.parse_args() | |
| 46 | |
| 47 | |
| 48 def main(): | |
| 49 args = _ParseArgs() | |
| 50 logging.basicConfig(level=logging.INFO, | |
| 51 format='%(asctime)s %(filename)s:%(lineno)-3d' | |
| 52 ' %(levelname)s %(message)s', | |
| 53 datefmt='%y%m%d %H:%M:%S') | |
| 54 return ArchiveRetrySummary(args) | |
| 55 | |
| 56 | |
| 57 if '__main__' == __name__: | |
| 58 sys.exit(main()) | |
| OLD | NEW |