OLD | NEW |
---|---|
(Empty) | |
1 #!/usr/bin/env python | |
2 # Copyright (c) 2013 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 """Upload results from running skimage.""" | |
7 | |
8 import posixpath | |
9 import sys | |
10 | |
11 from get_subdir import GetSubDirFromBuilderName | |
12 from utils import gs_utils | |
13 from utils import sync_bucket_subdir | |
14 from build_step import PLAYBACK_CANNED_ACL | |
15 from build_step import BuildStep | |
16 | |
17 import build_step | |
18 | |
19 SKP_TIMEOUT_MULTIPLIER = 8 | |
20 | |
21 class UploadSKImageResults(BuildStep): | |
22 | |
23 def __init__( | |
24 self, | |
25 timeout=build_step.DEFAULT_TIMEOUT * SKP_TIMEOUT_MULTIPLIER, | |
26 no_output_timeout=( | |
27 build_step.DEFAULT_NO_OUTPUT_TIMEOUT * SKP_TIMEOUT_MULTIPLIER), | |
28 **kwargs): | |
29 """Constructs an UploadSKImageResults BuildStep instance. | |
30 | |
31 timeout: maximum time allowed for this BuildStep. The default value here is | |
32 increased because there could be a lot of images | |
33 to be copied over to Google Storage. | |
34 no_output_timeout: maximum time allowed for this BuildStep to run without | |
35 any output. | |
36 """ | |
37 build_step.BuildStep.__init__(self, timeout=timeout, | |
38 no_output_timeout=no_output_timeout, | |
39 **kwargs) | |
40 | |
41 self._dest_gsbase = (self._args.get('dest_gsbase') or | |
42 sync_bucket_subdir.DEFAULT_PERFDATA_GS_BASE) | |
43 | |
44 def _Run(self): | |
45 if self._do_upload_results: | |
46 # Copy actual images and expectations to Google Storage. | |
47 print '\n\n========Uploading skimage results to Google Storage=======\n\n' | |
48 subdir = GetSubDirFromBuilderName(self._builder_name) | |
49 relative_dir = posixpath.join('skimage', 'output', subdir) | |
50 gs_utils.UploadDirectoryContentsIfChanged( | |
borenet
2013/06/25 18:19:12
Note that this mechanism will change very soon, on
scroggo
2013/06/25 19:28:56
Noted. I'll keep watch on Elliot's progress.
| |
51 gs_base=self._dest_gsbase, | |
52 # Figure out the relative dir | |
53 gs_relative_dir=relative_dir, | |
54 gs_acl=PLAYBACK_CANNED_ACL, | |
55 force_upload=True, | |
56 local_dir=self._skimage_out_dir) | |
57 | |
58 if '__main__' == __name__: | |
59 sys.exit(BuildStep.RunBuildStep(UploadSKImageResults)) | |
OLD | NEW |