Exemplo n.º 1
0
  def __init__(self, archive_data_file='', cloud_storage_bucket=None,
               base_dir=None, serving_dirs=None):
    """Creates a new StorySet.

    Args:
      archive_data_file: The path to Web Page Replay's archive data, relative
          to self.base_dir.
      cloud_storage_bucket: The cloud storage bucket used to download
          Web Page Replay's archive data. Valid values are: None,
          story.PUBLIC_BUCKET, story.PARTNER_BUCKET, or story.INTERNAL_BUCKET
          (defined in telemetry.util.cloud_storage).
      serving_dirs: A set of paths, relative to self.base_dir, to directories
          containing hash files for non-wpr archive data stored in cloud
          storage.
    """
    self._stories = []
    self._story_names_and_grouping_keys = set()
    self._archive_data_file = archive_data_file
    self._wpr_archive_info = None
    archive_info.AssertValidCloudStorageBucket(cloud_storage_bucket)
    self._cloud_storage_bucket = cloud_storage_bucket
    if base_dir:
      if not os.path.isdir(base_dir):
        raise ValueError('Invalid directory path of base_dir: %s' % base_dir)
      self._base_dir = base_dir
    else:
      self._base_dir = os.path.dirname(inspect.getfile(self.__class__))
    # Convert any relative serving_dirs to absolute paths.
    self._serving_dirs = set(os.path.realpath(os.path.join(self.base_dir, d))
                             for d in serving_dirs or [])
Exemplo n.º 2
0
    def __init__(self,
                 archive_data_file='',
                 cloud_storage_bucket=None,
                 serving_dirs=None):
        """Creates a new UserStorySet.

    Args:
      archive_data_file: The path to Web Page Replay's archive data, relative
          to self.base_dir.
      cloud_storage_bucket: The cloud storage bucket used to download
          Web Page Replay's archive data. Valid values are: None,
          PUBLIC_BUCKET, PARTNER_BUCKET, or INTERNAL_BUCKET (defined
          in telemetry.util.cloud_storage).
    """
        self.user_stories = []
        self._archive_data_file = archive_data_file
        self._wpr_archive_info = None
        archive_info.AssertValidCloudStorageBucket(cloud_storage_bucket)
        self._cloud_storage_bucket = cloud_storage_bucket
        self._base_dir = os.path.dirname(inspect.getfile(self.__class__))
        # Convert any relative serving_dirs to absolute paths.
        self._serving_dirs = set(
            os.path.realpath(os.path.join(self.base_dir, d))
            for d in serving_dirs or [])