| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Upload results from running skimage.""" | 6 """Upload results from running skimage.""" |
| 7 | 7 |
| 8 import build_step | 8 import build_step |
| 9 import os | 9 import os |
| 10 import posixpath | 10 import posixpath |
| 11 # Must be imported after build_step, which adds site_config to the python path. | 11 # Must be imported after build_step, which adds site_config to the python path. |
| 12 import skia_vars | 12 import skia_vars |
| 13 import sys | 13 import sys |
| 14 | 14 |
| 15 from utils import old_gs_utils as gs_utils | 15 from utils import gs_utils |
| 16 from utils import old_gs_utils |
| 16 from utils import sync_bucket_subdir | 17 from utils import sync_bucket_subdir |
| 17 from build_step import PLAYBACK_CANNED_ACL | |
| 18 from build_step import BuildStep | 18 from build_step import BuildStep |
| 19 | 19 |
| 20 SKP_TIMEOUT_MULTIPLIER = 8 | 20 SKP_TIMEOUT_MULTIPLIER = 8 |
| 21 | 21 |
| 22 class UploadSKImageResults(BuildStep): | 22 class UploadSKImageResults(BuildStep): |
| 23 | 23 |
| 24 def __init__( | 24 def __init__( |
| 25 self, | 25 self, |
| 26 timeout=build_step.DEFAULT_TIMEOUT * SKP_TIMEOUT_MULTIPLIER, | 26 timeout=build_step.DEFAULT_TIMEOUT * SKP_TIMEOUT_MULTIPLIER, |
| 27 no_output_timeout=( | 27 no_output_timeout=( |
| (...skipping 16 matching lines...) Expand all Loading... |
| 44 | 44 |
| 45 def _Run(self): | 45 def _Run(self): |
| 46 # Copy actual-results.json to skimage/actuals | 46 # Copy actual-results.json to skimage/actuals |
| 47 print '\n\n====Uploading skimage actual-results to Google Storage====\n\n' | 47 print '\n\n====Uploading skimage actual-results to Google Storage====\n\n' |
| 48 src_dir = os.path.abspath(os.path.join(self._skimage_out_dir, | 48 src_dir = os.path.abspath(os.path.join(self._skimage_out_dir, |
| 49 self._builder_name)) | 49 self._builder_name)) |
| 50 dest_dir = posixpath.join( | 50 dest_dir = posixpath.join( |
| 51 skia_vars.GetGlobalVariable('googlestorage_bucket'), | 51 skia_vars.GetGlobalVariable('googlestorage_bucket'), |
| 52 'skimage', 'actuals', self._builder_name) | 52 'skimage', 'actuals', self._builder_name) |
| 53 http_header_lines = ['Cache-Control:public,max-age=3600'] | 53 http_header_lines = ['Cache-Control:public,max-age=3600'] |
| 54 gs_utils.upload_dir_contents(local_src_dir=src_dir, | 54 old_gs_utils.upload_dir_contents(local_src_dir=src_dir, |
| 55 remote_dest_dir=dest_dir, | 55 remote_dest_dir=dest_dir, |
| 56 gs_acl='public-read', | 56 gs_acl='public-read', |
| 57 http_header_lines=http_header_lines) | 57 http_header_lines=http_header_lines) |
| 58 | 58 |
| 59 # Copy actual images to Google Storage at skimage/output. This will merge | 59 # Copy actual images to Google Storage at skimage/output. This will merge |
| 60 # with the existing files. | 60 # with the existing files. |
| 61 print '\n\n========Uploading skimage results to Google Storage=======\n\n' | 61 print '\n\n========Uploading skimage results to Google Storage=======\n\n' |
| 62 src_dir = os.path.abspath(os.path.join(self._skimage_out_dir, 'images')) | 62 src_dir = os.path.abspath(os.path.join(self._skimage_out_dir, 'images')) |
| 63 dest_dir = posixpath.join( | 63 dest_dir = posixpath.join( |
| 64 skia_vars.GetGlobalVariable('googlestorage_bucket'), | 64 skia_vars.GetGlobalVariable('googlestorage_bucket'), |
| 65 'skimage', 'output', 'images') | 65 'skimage', 'output', 'images') |
| 66 if os.path.isdir(src_dir) and os.listdir(src_dir): | 66 if os.path.isdir(src_dir) and os.listdir(src_dir): |
| 67 gs_utils.upload_dir_contents(local_src_dir=src_dir, | 67 old_gs_utils.upload_dir_contents( |
| 68 remote_dest_dir=dest_dir, | 68 local_src_dir=src_dir, remote_dest_dir=dest_dir, |
| 69 gs_acl=PLAYBACK_CANNED_ACL) | 69 gs_acl=gs_utils.GSUtils.PLAYBACK_CANNED_ACL) |
| 70 | 70 |
| 71 if '__main__' == __name__: | 71 if '__main__' == __name__: |
| 72 sys.exit(BuildStep.RunBuildStep(UploadSKImageResults)) | 72 sys.exit(BuildStep.RunBuildStep(UploadSKImageResults)) |
| OLD | NEW |