Esempio n. 1
0
from perfkitbenchmarker import errors
from perfkitbenchmarker import flags

FLAGS = flags.FLAGS
CONFIG_CONSTANTS = 'default_config_constants.yaml'

flags.DEFINE_string('benchmark_config_file', None,
                    'The file path to the user config file which will '
                    'override benchmark defaults. This should either be '
                    'a path relative to the current working directory, '
                    'an absolute path, or just the name of a file in the '
                    'configs/ directory.')
flags.DEFINE_multistring(
    'config_override', None,
    'This flag can be used to override any config value. It is applied after '
    'the user config (specified via --benchmark_config_file_path), so it has '
    'a higher priority than that config. The value of the flag should be '
    'fully.qualified.key=value (e.g. --config_override=cluster_boot.vm_groups.'
    'default.vm_count=4). This flag can be repeated.')

# Config keys.
VM_GROUPS = 'vm_groups'
DESCRIPTION = 'description'
CONFIG_FLAGS = 'flags'
CONFIG_VALUE_TYPES = {
    VM_GROUPS: [dict],
    DESCRIPTION: [str],
    CONFIG_FLAGS: [dict]
}
VALID_CONFIG_KEYS = frozenset(CONFIG_VALUE_TYPES.keys())
REQUIRED_CONFIG_KEYS = frozenset([VM_GROUPS])
Esempio n. 2
0
    '"[project_id:]dataset_name.table_name".')
flags.DEFINE_string('bq_path', 'bq', 'Path to the "bq" executable.')
flags.DEFINE_string('bq_project', None,
                    'Project to use for authenticating with BigQuery.')
flags.DEFINE_string('service_account', None,
                    'Service account to use to authenticate with BQ.')
flags.DEFINE_string('service_account_private_key', None,
                    'Service private key for authenticating with BQ.')

flags.DEFINE_string('gsutil_path', 'gsutil', 'path to the "gsutil" executable')
flags.DEFINE_string('cloud_storage_bucket', None,
                    'GCS bucket to upload records to. Bucket must exist.')

flags.DEFINE_multistring(
    'metadata', [],
    'A colon separated key-value pair that will be added to the labels field '
    'of all samples as metadata. Multiple key-value pairs may be specified '
    'by separating each pair by commas.')

DEFAULT_JSON_OUTPUT_NAME = 'perfkitbenchmarker_results.json'
DEFAULT_CREDENTIALS_JSON = 'credentials.json'
GCS_OBJECT_NAME_LENGTH = 20


def GetLabelsFromDict(metadata):
    """Converts a metadata dictionary to a string of labels.

  Args:
    metadata: a dictionary of string key value pairs.

  Returns:
Esempio n. 3
0
"""

import abc
import logging
import os
import shutil

import pkg_resources

from perfkitbenchmarker import flags
from perfkitbenchmarker import temp_dir

FLAGS = flags.FLAGS

flags.DEFINE_multistring(
    'data_search_paths', ['.'], 'Additional paths to search for data files. '
    'These paths will be searched prior to using files '
    'bundled with PerfKitBenchmarker')

_RESOURCES = 'resources'


class ResourceNotFound(ValueError):
    """Error raised when a resource could not be found on the search path."""
    pass


class ResourceLoader(object):
    """An interface for loading named resources."""

    __metaclass__ = abc.ABCMeta
Esempio n. 4
0
    ' be resolved. See: '
    'https://cloud.google.com/sdk/gcloud/reference/compute/disks/create')
flags.DEFINE_string(
    'gce_network_name', None, 'The name of an already created '
    'network to use instead of creating a new one.')
flags.DEFINE_string(
    'gce_subnet_region', None, 'Region to create subnet in '
    'instead of automatically creating one in every region.')
flags.DEFINE_string(
    'gce_subnet_addr', '10.128.0.0/20', 'Address range to the '
    'subnet, given in CDR notation. Not used unless '
    '--gce_subnet_region is given.')
flags.DEFINE_multistring(
    'gcp_instance_metadata_from_file', [],
    'A colon separated key-value pair that will be added to the '
    '"--metadata-from-file" flag of the gcloud cli (with the colon replaced by '
    'the equal sign). Multiple key-value pairs may be specified by separating '
    'each pair by commas. This option can be repeated multiple times. For '
    'information about GCP instance metadata, see: --metadata-from-file from '
    '`gcloud help compute instances create`.')
flags.DEFINE_multistring(
    'gcp_instance_metadata', [],
    'A colon separated key-value pair that will be added to the '
    '"--metadata" flag of the gcloud cli (with the colon replaced by the equal '
    'sign). Multiple key-value pairs may be specified by separating each pair '
    'by commas. This option can be repeated multiple times. For information '
    'about GCP instance metadata, see: --metadata from '
    '`gcloud help compute instances create`.')
flags.DEFINE_integer('gce_boot_disk_size', None,
                     'The boot disk size in GB for GCP VMs.')
flags.DEFINE_enum('gce_boot_disk_type', None, ['pd-standard', 'pd-ssd'],
                  'The boot disk type for GCP VMs.')
Esempio n. 5
0
flags.DEFINE_list(
    'ceph_monitors', [], 'IP addresses and ports of Ceph Monitors. '
    'Must be provided when Ceph scratch disk is required. '
    'Example: "127.0.0.1:6789,192.168.1.1:6789"')

flags.DEFINE_string(
    'username', 'root',
    'User name that Perfkit will attempt to use in order to '
    'SSH into Docker instance.')

flags.DEFINE_boolean(
    'docker_in_privileged_mode', True,
    'If set to True, will attempt to create Docker containers '
    'in a privileged mode. Note that some benchmarks execute '
    'commands which are only allowed in privileged mode.')
flags.DEFINE_boolean(
    'kubernetes_anti_affinity', True,
    'If set to True, PKB pods will not be scheduled on the '
    'same nodes as other PKB pods.')
flags.DEFINE_multistring(
    'k8s_volume_parameters', None,
    'A colon separated key-value pair that will be '
    'added to Kubernetes storage class parameters.')
_K8S_PROVISIONERS = [
    'kubernetes.io/azure-disk', 'kubernetes.io/gce-pd', 'kubernetes.io/aws-ebs'
]
flags.DEFINE_enum(
    'k8s_volume_provisioner', None, _K8S_PROVISIONERS,
    'The name of the provisioner to use for K8s storage '
    'classes.')