コード例 #1
0
  def _ValidateSpec(self):
    """Validates PostgreSQL spec for CPU and memory.

    Raises:
      data.ResourceNotFound: On missing memory or cpus in postgres benchmark
        config.
    """
    if not hasattr(self.spec.db_spec, 'cpus') or not self.spec.db_spec.cpus:
      raise data.ResourceNotFound(
          'Must specify cpu count in benchmark config. See https://'
          'cloud.google.com/sql/docs/postgres/instance-settings for more '
          'details about size restrictions.')
    if not hasattr(self.spec.db_spec, 'memory') or not self.spec.db_spec.memory:
      raise data.ResourceNotFound(
          'Must specify a memory amount in benchmark config. See https://'
          'cloud.google.com/sql/docs/postgres/instance-settings for more '
          'details about size restrictions.')
コード例 #2
0
def CheckPrerequisites():
    """Verifies that the required resources are present.

  Raises:
    perfkitbenchmarker.data.ResourceNotFound: On missing resource.
  """
    local_path = _GetLocalPath()
    if not os.path.exists(local_path):
        raise data.ResourceNotFound(
            'AWS credential files were not found at {0}'.format(local_path))