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 utils import gs_utils |
| 12 from utils import sync_bucket_subdir |
| 13 from build_step import PLAYBACK_CANNED_ACL |
| 14 from build_step import BuildStep |
| 15 |
| 16 import build_step |
| 17 |
| 18 SKP_TIMEOUT_MULTIPLIER = 8 |
| 19 |
| 20 class UploadSKImageResults(BuildStep): |
| 21 |
| 22 def __init__( |
| 23 self, |
| 24 timeout=build_step.DEFAULT_TIMEOUT * SKP_TIMEOUT_MULTIPLIER, |
| 25 no_output_timeout=( |
| 26 build_step.DEFAULT_NO_OUTPUT_TIMEOUT * SKP_TIMEOUT_MULTIPLIER), |
| 27 **kwargs): |
| 28 """Constructs an UploadSKImageResults BuildStep instance. |
| 29 |
| 30 timeout: maximum time allowed for this BuildStep. The default value here is |
| 31 increased because there could be a lot of images |
| 32 to be copied over to Google Storage. |
| 33 no_output_timeout: maximum time allowed for this BuildStep to run without |
| 34 any output. |
| 35 """ |
| 36 build_step.BuildStep.__init__(self, timeout=timeout, |
| 37 no_output_timeout=no_output_timeout, |
| 38 **kwargs) |
| 39 |
| 40 self._dest_gsbase = (self._args.get('dest_gsbase') or |
| 41 sync_bucket_subdir.DEFAULT_PERFDATA_GS_BASE) |
| 42 |
| 43 def _Run(self): |
| 44 if self._do_upload_results and self._gm_image_subdir: |
| 45 # Copy actual images and expectations to Google Storage. |
| 46 print '\n\n========Uploading skimage results to Google Storage=======\n\n' |
| 47 relative_dir = posixpath.join('skimage', 'output', self._gm_image_subdir) |
| 48 gs_utils.UploadDirectoryContentsIfChanged( |
| 49 gs_base=self._dest_gsbase, |
| 50 gs_relative_dir=relative_dir, |
| 51 gs_acl=PLAYBACK_CANNED_ACL, |
| 52 force_upload=True, |
| 53 local_dir=self._skimage_out_dir) |
| 54 |
| 55 if '__main__' == __name__: |
| 56 sys.exit(BuildStep.RunBuildStep(UploadSKImageResults)) |
OLD | NEW |