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

Side by Side Diff: tools/skp/webpages_playback.py

Issue 1658653002: Upload SKPs to chrome-partner-telemetry (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Fixes Created 4 years, 10 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
« no previous file with comments | « tools/skp/recreate_skps.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 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 """Archives or replays webpages and creates SKPs in a Google Storage location. 6 """Archives or replays webpages and creates SKPs in a Google Storage location.
7 7
8 To archive webpages and store SKP files (archives should be rarely updated): 8 To archive webpages and store SKP files (archives should be rarely updated):
9 9
10 cd skia 10 cd skia
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 import traceback 64 import traceback
65 65
66 sys.path.insert(0, os.getcwd()) 66 sys.path.insert(0, os.getcwd())
67 67
68 from common.py.utils import gs_utils 68 from common.py.utils import gs_utils
69 from common.py.utils import shell_utils 69 from common.py.utils import shell_utils
70 70
71 ROOT_PLAYBACK_DIR_NAME = 'playback' 71 ROOT_PLAYBACK_DIR_NAME = 'playback'
72 SKPICTURES_DIR_NAME = 'skps' 72 SKPICTURES_DIR_NAME = 'skps'
73 73
74 PARTNERS_GS_BUCKET = 'gs://chrome-partner-telemetry'
74 75
75 # Local archive and SKP directories. 76 # Local archive and SKP directories.
76 LOCAL_PLAYBACK_ROOT_DIR = os.path.join( 77 LOCAL_PLAYBACK_ROOT_DIR = os.path.join(
77 tempfile.gettempdir(), ROOT_PLAYBACK_DIR_NAME) 78 tempfile.gettempdir(), ROOT_PLAYBACK_DIR_NAME)
78 LOCAL_REPLAY_WEBPAGES_ARCHIVE_DIR = os.path.join( 79 LOCAL_REPLAY_WEBPAGES_ARCHIVE_DIR = os.path.join(
79 os.path.abspath(os.path.dirname(__file__)), 'page_sets', 'data') 80 os.path.abspath(os.path.dirname(__file__)), 'page_sets', 'data')
80 TMP_SKP_DIR = tempfile.mkdtemp() 81 TMP_SKP_DIR = tempfile.mkdtemp()
81 82
82 # Location of the credentials.json file and the string that represents missing 83 # Location of the credentials.json file and the string that represents missing
83 # passwords. 84 # passwords.
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 self._record = parse_options.record 152 self._record = parse_options.record
152 self._skia_tools = parse_options.skia_tools 153 self._skia_tools = parse_options.skia_tools
153 self._non_interactive = parse_options.non_interactive 154 self._non_interactive = parse_options.non_interactive
154 self._upload = parse_options.upload 155 self._upload = parse_options.upload
155 self._skp_prefix = parse_options.skp_prefix 156 self._skp_prefix = parse_options.skp_prefix
156 data_store_location = parse_options.data_store 157 data_store_location = parse_options.data_store
157 if data_store_location.startswith(gs_utils.GS_PREFIX): 158 if data_store_location.startswith(gs_utils.GS_PREFIX):
158 self.gs = GoogleStorageDataStore(data_store_location) 159 self.gs = GoogleStorageDataStore(data_store_location)
159 else: 160 else:
160 self.gs = LocalFileSystemDataStore(data_store_location) 161 self.gs = LocalFileSystemDataStore(data_store_location)
162 self._upload_to_partner_bucket = parse_options.upload_to_partner_bucket
161 self._alternate_upload_dir = parse_options.alternate_upload_dir 163 self._alternate_upload_dir = parse_options.alternate_upload_dir
162 self._telemetry_binaries_dir = os.path.join(parse_options.chrome_src_path, 164 self._telemetry_binaries_dir = os.path.join(parse_options.chrome_src_path,
163 'tools', 'perf') 165 'tools', 'perf')
164 166
165 self._local_skp_dir = os.path.join( 167 self._local_skp_dir = os.path.join(
166 parse_options.output_dir, ROOT_PLAYBACK_DIR_NAME, SKPICTURES_DIR_NAME) 168 parse_options.output_dir, ROOT_PLAYBACK_DIR_NAME, SKPICTURES_DIR_NAME)
167 self._local_record_webpages_archive_dir = os.path.join( 169 self._local_record_webpages_archive_dir = os.path.join(
168 parse_options.output_dir, ROOT_PLAYBACK_DIR_NAME, 'webpages_archive') 170 parse_options.output_dir, ROOT_PLAYBACK_DIR_NAME, 'webpages_archive')
169 171
170 # List of SKP files generated by this script. 172 # List of SKP files generated by this script.
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 363
362 self.gs.upload_dir_contents( 364 self.gs.upload_dir_contents(
363 LOCAL_PLAYBACK_ROOT_DIR, dest_dir=dest_dir_name, 365 LOCAL_PLAYBACK_ROOT_DIR, dest_dir=dest_dir_name,
364 upload_if=gs_utils.GSUtils.UploadIf.IF_MODIFIED, 366 upload_if=gs_utils.GSUtils.UploadIf.IF_MODIFIED,
365 predefined_acl=GS_PREDEFINED_ACL, 367 predefined_acl=GS_PREDEFINED_ACL,
366 fine_grained_acl_list=GS_FINE_GRAINED_ACL_LIST) 368 fine_grained_acl_list=GS_FINE_GRAINED_ACL_LIST)
367 369
368 print '\n\n=======New SKPs have been uploaded to %s =======\n\n' % ( 370 print '\n\n=======New SKPs have been uploaded to %s =======\n\n' % (
369 posixpath.join(self.gs.target_name(), dest_dir_name, 371 posixpath.join(self.gs.target_name(), dest_dir_name,
370 SKPICTURES_DIR_NAME)) 372 SKPICTURES_DIR_NAME))
373
374 if self._upload_to_partner_bucket:
375 print '\n\n=======Uploading to Partner bucket %s =======\n\n' % (
376 PARTNERS_GS_BUCKET)
377 partner_gs = GoogleStorageDataStore(PARTNERS_GS_BUCKET)
378 partner_gs.upload_dir_contents(
379 os.path.join(LOCAL_PLAYBACK_ROOT_DIR, SKPICTURES_DIR_NAME),
380 dest_dir=posixpath.join(SKPICTURES_DIR_NAME, dest_dir_name),
381 upload_if=gs_utils.GSUtils.UploadIf.IF_MODIFIED)
382 print '\n\n=======New SKPs have been uploaded to %s =======\n\n' % (
383 posixpath.join(partner_gs.target_name(), SKPICTURES_DIR_NAME,
384 dest_dir_name))
371 else: 385 else:
372 print '\n\n=======Not Uploading to %s=======\n\n' % self.gs.target_type() 386 print '\n\n=======Not Uploading to %s=======\n\n' % self.gs.target_type()
373 print 'Generated resources are available in %s\n\n' % ( 387 print 'Generated resources are available in %s\n\n' % (
374 LOCAL_PLAYBACK_ROOT_DIR) 388 LOCAL_PLAYBACK_ROOT_DIR)
375 389
376 return 0 390 return 0
377 391
378 def _GetSkiaSkpFileName(self, page_set): 392 def _GetSkiaSkpFileName(self, page_set):
379 """Returns the SKP file name for Skia page sets.""" 393 """Returns the SKP file name for Skia page sets."""
380 # /path/to/skia_yahooanswers_desktop.py -> skia_yahooanswers_desktop.py 394 # /path/to/skia_yahooanswers_desktop.py -> skia_yahooanswers_desktop.py
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 '--non-interactive then the debugger is also run at the end. Debug ' 541 '--non-interactive then the debugger is also run at the end. Debug '
528 'builds are recommended because they seem to catch more failures ' 542 'builds are recommended because they seem to catch more failures '
529 'than Release builds.'), 543 'than Release builds.'),
530 default=None) 544 default=None)
531 option_parser.add_option( 545 option_parser.add_option(
532 '', '--upload', action='store_true', 546 '', '--upload', action='store_true',
533 help=('Uploads to Google Storage or copies to local filesystem storage ' 547 help=('Uploads to Google Storage or copies to local filesystem storage '
534 ' if this is True.'), 548 ' if this is True.'),
535 default=False) 549 default=False)
536 option_parser.add_option( 550 option_parser.add_option(
551 '', '--upload_to_partner_bucket', action='store_true',
552 help=('Uploads SKPs to the chrome-partner-telemetry Google Storage '
553 'bucket if true.'),
554 default=False)
555 option_parser.add_option(
537 '', '--data_store', 556 '', '--data_store',
538 help=('The location of the file storage to use to download and upload ' 557 help=('The location of the file storage to use to download and upload '
539 'files. Can be \'gs://<bucket>\' for Google Storage, or ' 558 'files. Can be \'gs://<bucket>\' for Google Storage, or '
540 'a directory for local filesystem storage'), 559 'a directory for local filesystem storage'),
541 default='gs://chromium-skia-gm') 560 default='gs://chromium-skia-gm')
542 option_parser.add_option( 561 option_parser.add_option(
543 '', '--alternate_upload_dir', 562 '', '--alternate_upload_dir',
544 help= ('Uploads to a different directory in Google Storage or local ' 563 help= ('Uploads to a different directory in Google Storage or local '
545 'storage if this flag is specified'), 564 'storage if this flag is specified'),
546 default=None) 565 default=None)
(...skipping 20 matching lines...) Expand all
567 '--skia_tools is specified then the debugger is not run.', 586 '--skia_tools is specified then the debugger is not run.',
568 default=False) 587 default=False)
569 option_parser.add_option( 588 option_parser.add_option(
570 '', '--skp_prefix', 589 '', '--skp_prefix',
571 help='Prefix to add to the names of generated SKPs.', 590 help='Prefix to add to the names of generated SKPs.',
572 default=None) 591 default=None)
573 options, unused_args = option_parser.parse_args() 592 options, unused_args = option_parser.parse_args()
574 593
575 playback = SkPicturePlayback(options) 594 playback = SkPicturePlayback(options)
576 sys.exit(playback.Run()) 595 sys.exit(playback.Run())
OLDNEW
« no previous file with comments | « tools/skp/recreate_skps.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698