code
stringlengths
66
870k
docstring
stringlengths
19
26.7k
func_name
stringlengths
1
138
language
stringclasses
1 value
repo
stringlengths
7
68
path
stringlengths
5
324
url
stringlengths
46
389
license
stringclasses
7 values
def Attach(self, vm): """Attaches the disk to a VM. Args: vm: The AliVirtualMachine instance to which the disk will be attached. """ with self._lock: self.attached_vm_id = vm.id if self.attached_vm_id not in AliDisk.vm_devices: AliDisk.vm_devices[self.attached_vm_id] = set( ...
Attaches the disk to a VM. Args: vm: The AliVirtualMachine instance to which the disk will be attached.
Attach
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/alicloud/ali_disk.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/alicloud/ali_disk.py
Apache-2.0
def WaitForDiskStatus(self, status_list): """Waits until disk is attach to the instance.""" logging.info( "Waits until the disk's status is one of statuses: %s", status_list ) describe_cmd = util.ALI_PREFIX + [ 'ecs', 'DescribeDisks', '--RegionId %s' % self.region, ...
Waits until disk is attach to the instance.
WaitForDiskStatus
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/alicloud/ali_disk.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/alicloud/ali_disk.py
Apache-2.0
def _Exists(self): """Returns true if the VPC exists.""" describe_cmd = util.ALI_PREFIX + [ 'ecs', 'DescribeVpcs', '--RegionId %s' % self.region, '--VpcId %s' % self.id, ] describe_cmd = util.GetEncodedCmd(describe_cmd) stdout, _ = vm_util.IssueRetryableCommand(descri...
Returns true if the VPC exists.
_Exists
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/alicloud/ali_network.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/alicloud/ali_network.py
Apache-2.0
def _WaitForVpcStatus(self, status_list): """Waits until VPC's status is in status_list""" logging.info( 'Waits until the status of VPC is in status_list: %s', status_list ) describe_cmd = util.ALI_PREFIX + [ 'ecs', 'DescribeVpcs', '--RegionId %s' % self.region, '...
Waits until VPC's status is in status_list
_WaitForVpcStatus
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/alicloud/ali_network.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/alicloud/ali_network.py
Apache-2.0
def _Exists(self): """Returns true if the VSwitch exists.""" describe_cmd = util.ALI_PREFIX + [ 'ecs', 'DescribeVSwitches', '--RegionId %s' % self.region, '--VpcId %s' % self.vpc_id, '--ZoneId %s' % self.zone, ] describe_cmd = util.GetEncodedCmd(describe_cmd) ...
Returns true if the VSwitch exists.
_Exists
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/alicloud/ali_network.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/alicloud/ali_network.py
Apache-2.0
def _PostCreate(self): """Tag security group with default tags.""" util.AddDefaultTags( self.group_id, util.ResourceTypes.SECURITYGROUP, self.region )
Tag security group with default tags.
_PostCreate
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/alicloud/ali_network.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/alicloud/ali_network.py
Apache-2.0
def _Exists(self): """Returns true if the security group exists.""" show_cmd = util.ALI_PREFIX + [ 'ecs', 'DescribeSecurityGroups', '--RegionId %s' % self.region, '--SecurityGroupId %s' % self.group_id, ] show_cmd = util.GetEncodedCmd(show_cmd) stdout, _ = vm_util.Iss...
Returns true if the security group exists.
_Exists
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/alicloud/ali_network.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/alicloud/ali_network.py
Apache-2.0
def AllowIcmp(self, vm): """Opens the ICMP protocol on the firewall. Args: vm: The BaseVirtualMachine object to open the ICMP protocol for. """ if vm.is_static: return with self._lock: authorize_cmd = util.ALI_PREFIX + [ 'ecs', 'AuthorizeSecurityGroup', ...
Opens the ICMP protocol on the firewall. Args: vm: The BaseVirtualMachine object to open the ICMP protocol for.
AllowIcmp
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/alicloud/ali_network.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/alicloud/ali_network.py
Apache-2.0
def AllowPort(self, vm, start_port, end_port=None, source_range=None): """Opens a port on the firewall. Args: vm: The BaseVirtualMachine object to open the port for. start_port: The first local port in a range of ports to open. end_port: The last port in a range of ports to open. If None, onl...
Opens a port on the firewall. Args: vm: The BaseVirtualMachine object to open the port for. start_port: The first local port in a range of ports to open. end_port: The last port in a range of ports to open. If None, only start_port will be opened. source_range: unsupported at presen...
AllowPort
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/alicloud/ali_network.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/alicloud/ali_network.py
Apache-2.0
def _AllowPort(self, vm, port): """Opens a port on the firewall. Args: vm: The BaseVirtualMachine object to open the port for. port: The local port to open. """ if vm.is_static: return entry = (port, vm.group_id) if entry in self.firewall_set: return with self._lock:...
Opens a port on the firewall. Args: vm: The BaseVirtualMachine object to open the port for. port: The local port to open.
_AllowPort
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/alicloud/ali_network.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/alicloud/ali_network.py
Apache-2.0
def __init__(self, vm_spec): """Initialize a AliCloud virtual machine. Args: vm_spec: virtual_machine.BaseVirtualMachineSpec object of the VM. """ super().__init__(vm_spec) self.image = FLAGS.image self.user_name = FLAGS.ali_user_name self.key_pair_name = None self.region = util.G...
Initialize a AliCloud virtual machine. Args: vm_spec: virtual_machine.BaseVirtualMachineSpec object of the VM.
__init__
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/alicloud/ali_virtual_machine.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/alicloud/ali_virtual_machine.py
Apache-2.0
def _WaitForInstanceStatus(self, status_list): """Waits until the instance's status is in status_list.""" logging.info( "Waits until the instance's status is one of statuses: %s", status_list ) describe_cmd = util.ALI_PREFIX + [ 'ecs', 'DescribeInstances', '--RegionId %s'...
Waits until the instance's status is in status_list.
_WaitForInstanceStatus
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/alicloud/ali_virtual_machine.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/alicloud/ali_virtual_machine.py
Apache-2.0
def _AllocatePubIp(self, region, instance_id): """Allocate a public ip address and associate it to the instance.""" if FLAGS.ali_use_vpc: allocatip_cmd = util.ALI_PREFIX + [ 'ecs', 'AllocateEipAddress', '--RegionId %s' % region, '--InternetChargeType PayByTraffic', ...
Allocate a public ip address and associate it to the instance.
_AllocatePubIp
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/alicloud/ali_virtual_machine.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/alicloud/ali_virtual_machine.py
Apache-2.0
def _GetDefaultImage(cls, region): """Returns the default image given the machine type and region. If no default is configured, this will return None. """ if cls.IMAGE_NAME_FILTER is None: # pytype: disable=attribute-error return None describe_cmd = util.ALI_PREFIX + [ 'ecs', ...
Returns the default image given the machine type and region. If no default is configured, this will return None.
_GetDefaultImage
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/alicloud/ali_virtual_machine.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/alicloud/ali_virtual_machine.py
Apache-2.0
def _PostCreate(self): """Get the instance's data and tag it.""" describe_cmd = util.ALI_PREFIX + [ 'ecs', 'DescribeInstances', '--RegionId %s' % self.region, '--InstanceIds \'["%s"]\'' % self.id, ] logging.info( 'Getting instance %s public IP. This will fail unti...
Get the instance's data and tag it.
_PostCreate
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/alicloud/ali_virtual_machine.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/alicloud/ali_virtual_machine.py
Apache-2.0
def _Exists(self): """Returns true if the VM exists.""" describe_cmd = util.ALI_PREFIX + [ 'ecs', 'DescribeInstances', '--RegionId %s' % self.region, '--InstanceIds \'["%s"]\'' % str(self.id), ] describe_cmd = util.GetEncodedCmd(describe_cmd) stdout, _ = vm_util.Issue...
Returns true if the VM exists.
_Exists
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/alicloud/ali_virtual_machine.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/alicloud/ali_virtual_machine.py
Apache-2.0
def CreateScratchDisk(self, disk_spec): """Create a VM's scratch disk. Args: disk_spec: virtual_machine.BaseDiskSpec object of the disk. """ data_disk = ali_disk.AliDisk(disk_spec, self.zone) self.scratch_disks.append(data_disk) if disk_spec.disk_type != disk.LOCAL: data_disk.Creat...
Create a VM's scratch disk. Args: disk_spec: virtual_machine.BaseDiskSpec object of the disk.
CreateScratchDisk
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/alicloud/ali_virtual_machine.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/alicloud/ali_virtual_machine.py
Apache-2.0
def ImportKeyfile(cls, region): """Imports the public keyfile to AliCloud.""" with cls._lock: if FLAGS.run_uri in cls.run_uri_key_names: return cls.run_uri_key_names[FLAGS.run_uri] public_key = cls.GetPublicKey() key_name = cls.GetKeyNameForRun() import_cmd = util.ALI_PREFIX + [ ...
Imports the public keyfile to AliCloud.
ImportKeyfile
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/alicloud/ali_virtual_machine.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/alicloud/ali_virtual_machine.py
Apache-2.0
def AddTags(resource_id, resource_type, region, **kwargs): """Adds tags to an AliCloud resource created by PerfKitBenchmarker. Args: resource_id: An extant AliCloud resource to operate on. resource_type: The type of the resource. region: The AliCloud region 'resource_id' was created in. **kwargs: d...
Adds tags to an AliCloud resource created by PerfKitBenchmarker. Args: resource_id: An extant AliCloud resource to operate on. resource_type: The type of the resource. region: The AliCloud region 'resource_id' was created in. **kwargs: dict. Key-value pairs to set on the instance.
AddTags
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/alicloud/util.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/alicloud/util.py
Apache-2.0
def GetDefaultTags(timeout_minutes=None): """Returns the default tags for an AliCloud resource created by PKB. Tags include "owner", "perfkitbenchmarker-run", "timeout_utc", "create_time_utc", "benchmark", "perfkit_uuid", "benchmark_uid" Args: timeout_minutes: Timeout used for setting the timeout_utc tag....
Returns the default tags for an AliCloud resource created by PKB. Tags include "owner", "perfkitbenchmarker-run", "timeout_utc", "create_time_utc", "benchmark", "perfkit_uuid", "benchmark_uid" Args: timeout_minutes: Timeout used for setting the timeout_utc tag.
GetDefaultTags
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/alicloud/util.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/alicloud/util.py
Apache-2.0
def VPCAddDefaultTags(resource_id, resource_type, region, timeout_minutes=None): """Adds tags to an AliCloud VPC resource created by PerfKitBenchmarker. Args: resource_id: An extant AliCloud resource to operate on. resource_type: The type of the 'resource_id' region: The AliCloud region 'resource_id' w...
Adds tags to an AliCloud VPC resource created by PerfKitBenchmarker. Args: resource_id: An extant AliCloud resource to operate on. resource_type: The type of the 'resource_id' region: The AliCloud region 'resource_id' was created in. timeout_minutes: Timeout used for setting the timeout_utc tag.
VPCAddDefaultTags
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/alicloud/util.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/alicloud/util.py
Apache-2.0
def GetAthenaClientInterface( database: str, output_bucket: str, region: str ) -> edw_service.EdwClientInterface: """Builds and Returns the requested Athena client Interface. Args: database: Name of the Athena database to execute queries against. output_bucket: String name of the S3 bucket to store que...
Builds and Returns the requested Athena client Interface. Args: database: Name of the Athena database to execute queries against. output_bucket: String name of the S3 bucket to store query output. region: String aws region in which the database exists and client operations are performed. Returns...
GetAthenaClientInterface
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/athena.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/athena.py
Apache-2.0
def GetMetadata(self) -> Dict[str, str]: """Gets the Metadata attributes for the Client Interface.""" client_workgroup = FLAGS.athena_workgroup or 'dynamic' return { 'client': f'{FLAGS.athena_client_interface}_{client_workgroup}', 'client_region': self.region, }
Gets the Metadata attributes for the Client Interface.
GetMetadata
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/athena.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/athena.py
Apache-2.0
def Prepare(self, package_name: str) -> None: """Prepares the client vm to execute query. Installs the Java Execution Environment and a uber jar with a) Athena Java client libraries, b) An application to execute a query and gather execution details, and collect CW metrics c) their dependencies....
Prepares the client vm to execute query. Installs the Java Execution Environment and a uber jar with a) Athena Java client libraries, b) An application to execute a query and gather execution details, and collect CW metrics c) their dependencies. Args: package_name: String name of the pa...
Prepare
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/athena.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/athena.py
Apache-2.0
def ExecuteQuery( self, query_name: str, print_results: bool = False ) -> tuple[float, dict[str, Any]]: """Executes a query and returns performance details. Args: query_name: String name of the query to execute print_results: Whether to include query results in execution details. Retur...
Executes a query and returns performance details. Args: query_name: String name of the query to execute print_results: Whether to include query results in execution details. Returns: A tuple of (execution_time, run_metadata) execution_time: A Float variable set to the query's completio...
ExecuteQuery
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/athena.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/athena.py
Apache-2.0
def PrepareQueryString(query_string_template, substitutions): """Method to read a template Athena script and substitute placeholders. Args: query_string_template: Template version of the Athena query. substitutions: A dictionary of string placeholder keys and corresponding string values. Returns: ...
Method to read a template Athena script and substitute placeholders. Args: query_string_template: Template version of the Athena query. substitutions: A dictionary of string placeholder keys and corresponding string values. Returns: Materialized Athena query as a string.
PrepareQueryString
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/athena.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/athena.py
Apache-2.0
def RunScriptCommand(script_command): """Method to execute an AWS Athena cli command. Args: script_command: Fully compiled AWS Athena cli command. Returns: String stdout result of executing the query. Script Command execution duration in seconds (rounded). Raises: AthenaQueryError: If the ret...
Method to execute an AWS Athena cli command. Args: script_command: Fully compiled AWS Athena cli command. Returns: String stdout result of executing the query. Script Command execution duration in seconds (rounded). Raises: AthenaQueryError: If the return code does not indicate success.
RunScriptCommand
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/athena.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/athena.py
Apache-2.0
def BuildAthenaCommand(self, query_string, database=None): """Method to compile a AWS Athena cli command. Arguments: query_string: A string with the query that needs to be executed on Athena. database: The Athena database against which the query should be executed. Returns: Fully compile...
Method to compile a AWS Athena cli command. Arguments: query_string: A string with the query that needs to be executed on Athena. database: The Athena database against which the query should be executed. Returns: Fully compiled AWS Athena cli command.
BuildAthenaCommand
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/athena.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/athena.py
Apache-2.0
def _EmptyDatabase(): """Remove tables, if they exist, so they can be refreshed. If the database and/or tables don't already exist, the drop commands will simply fail, which won't raise errors. """ drop_script_path = data.ResourcePath( 'edw/athena/%s/ddl/drop.sql' % FLAGS.edw_tp...
Remove tables, if they exist, so they can be refreshed. If the database and/or tables don't already exist, the drop commands will simply fail, which won't raise errors.
_EmptyDatabase
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/athena.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/athena.py
Apache-2.0
def GetDataDetails(self) -> Dict[str, str]: """Returns a dictionary with underlying data details. cluster_identifier = <dataset_id> Data details are extracted from the dataset_id that follows the format: <dataset>_<format>_<compression>_<partitioning> eg. tpch100_parquet_uncompressed_unpartiton...
Returns a dictionary with underlying data details. cluster_identifier = <dataset_id> Data details are extracted from the dataset_id that follows the format: <dataset>_<format>_<compression>_<partitioning> eg. tpch100_parquet_uncompressed_unpartitoned Returns: A dictionary set to underlyi...
GetDataDetails
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/athena.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/athena.py
Apache-2.0
def GetMetadata(self): """Return a dictionary of the metadata for the Athena data warehouse.""" basic_data = super().GetMetadata() basic_data.update({'database': self.cluster_identifier}) basic_data.update(self.GetDataDetails()) basic_data.update(self.client_interface.GetMetadata()) return basic...
Return a dictionary of the metadata for the Athena data warehouse.
GetMetadata
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/athena.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/athena.py
Apache-2.0
def _Create(self): """Creates the AWS RDS instance. Raises: Exception: if unknown how to create self.spec.engine. """ zones_needed_for_high_availability = len(self.zones) > 1 if zones_needed_for_high_availability != self.spec.high_availability: raise Exception( 'When db_high_a...
Creates the AWS RDS instance. Raises: Exception: if unknown how to create self.spec.engine.
_Create
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_aurora_db.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_aurora_db.py
Apache-2.0
def _UpdateInstanceClass(self, instance_id: str, instance_class: str) -> None: """Updates DBInstanceClass for the writer instance.""" current_instance_class = self._DescribeInstance(instance_id)['DBInstances'][ 0 ]['DBInstanceClass'] if current_instance_class != instance_class: logging.inf...
Updates DBInstanceClass for the writer instance.
_UpdateInstanceClass
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_aurora_db.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_aurora_db.py
Apache-2.0
def _ClusterExists(self): """Returns true if the underlying cluster exists.""" json_output = self._DescribeCluster() if json_output: return True return False
Returns true if the underlying cluster exists.
_ClusterExists
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_aurora_db.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_aurora_db.py
Apache-2.0
def _SetEndpoint(self): """Assigns the ports and endpoints from the cluster_id to self. These will be used to communicate with the data base. """ json_output = self._DescribeCluster() self.endpoint = json_output['DBClusters'][0]['Endpoint'] if 'ReaderEndpoint' in json_output['DBClusters'][0]: ...
Assigns the ports and endpoints from the cluster_id to self. These will be used to communicate with the data base.
_SetEndpoint
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_aurora_db.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_aurora_db.py
Apache-2.0
def _FailoverHA(self): """Fail over from master to replica.""" new_primary_id = self.all_instance_ids[1] cmd = util.AWS_PREFIX + [ 'rds', 'failover-db-cluster', '--db-cluster-identifier=%s' % self.cluster_id, '--target-db-instance-identifier=%s' % new_primary_id, '--r...
Fail over from master to replica.
_FailoverHA
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_aurora_db.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_aurora_db.py
Apache-2.0
def GetDefaultEngineVersion(engine): """Returns the default version of a given database engine. Args: engine (string): type of database (my_sql or postgres). Returns: (string): Default engine version. Raises: Exception: If unrecognized engine is specified. """ if engine not i...
Returns the default version of a given database engine. Args: engine (string): type of database (my_sql or postgres). Returns: (string): Default engine version. Raises: Exception: If unrecognized engine is specified.
GetDefaultEngineVersion
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_aurora_db.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_aurora_db.py
Apache-2.0
def _Create(self): """Creates the AWS CapacaityReservation. A reservation will be created given the VM shape in self.vm_groups. Count is determined by the number of VMs in said group. The reservation will have a lifetime determined by the general PKB concept of timeout_minutes. If the reservation e...
Creates the AWS CapacaityReservation. A reservation will be created given the VM shape in self.vm_groups. Count is determined by the number of VMs in said group. The reservation will have a lifetime determined by the general PKB concept of timeout_minutes. If the reservation exceeds this timeout, AWS w...
_Create
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_capacity_reservation.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_capacity_reservation.py
Apache-2.0
def _Exists(self): """Returns true if the underlying reservation exists and is active.""" cmd = util.AWS_PREFIX + [ 'ec2', 'describe-capacity-reservations', '--capacity-reservation-id=%s' % self.capacity_reservation_id, '--region=%s' % self.region, ] stdout, _, retcode = ...
Returns true if the underlying reservation exists and is active.
_Exists
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_capacity_reservation.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_capacity_reservation.py
Apache-2.0
def _UpdateVmsInGroup(self, capacity_reservation_id, zone): """Updates the VMs in a group with necessary reservation details. AWS virtual machines need to reference the capacity reservation id during creation, so it is set on all VMs in the group. Additionally, this class may determine which zone to ru...
Updates the VMs in a group with necessary reservation details. AWS virtual machines need to reference the capacity reservation id during creation, so it is set on all VMs in the group. Additionally, this class may determine which zone to run in, so that needs to be updated too (on the VM, and the VM's ...
_UpdateVmsInGroup
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_capacity_reservation.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_capacity_reservation.py
Apache-2.0
def _CreateDependencies(self): """Create dependencies for parallel cluster. Dependencies includes key files, vpcs and cloudformation template. """ # Create keypair, VPC & Subnet self._key_manager.ImportKeyfile(self.region) # Use pcluster to create and configure vpc & subnet # Headnode needs...
Create dependencies for parallel cluster. Dependencies includes key files, vpcs and cloudformation template.
_CreateDependencies
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_cluster.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_cluster.py
Apache-2.0
def _RenderClusterConfig(self): """Render the config file that will be used to create the cluster.""" tags = util.MakeDefaultTags(FLAGS.timeout_minutes) with open(data.ResourcePath(self.template)) as content: template = jinja2.Template( content.read(), undefined=jinja2.StrictUndefined ...
Render the config file that will be used to create the cluster.
_RenderClusterConfig
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_cluster.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_cluster.py
Apache-2.0
def _WaitUntilRunning(self): """Waits until the cluster is (or was) running.""" stdout, _, _ = vm_util.IssueCommand([ flags.PCLUSTER_PATH.value, 'describe-cluster', '--cluster-name', self.name, '--region', self.region, ]) status = json.loads(stdout)['clust...
Waits until the cluster is (or was) running.
_WaitUntilRunning
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_cluster.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_cluster.py
Apache-2.0
def _PostCreate(self): """Backfill VM object after cluster creation.""" self.worker_vms = [] stdout, _, _ = vm_util.IssueCommand([ flags.PCLUSTER_PATH.value, 'describe-cluster-instances', '--cluster-name', self.name, '--region', self.region, ]) def _P...
Backfill VM object after cluster creation.
_PostCreate
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_cluster.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_cluster.py
Apache-2.0
def _Exists(self): """Returns True if the repository exists.""" describe_cmd = util.AWS_PREFIX + [ 'ecr', 'describe-repositories', '--region', self.region, '--repository-names', self.name, ] stdout, _, _ = vm_util.IssueCommand(describe_cmd, raise_on_failur...
Returns True if the repository exists.
_Exists
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_container_service.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_container_service.py
Apache-2.0
def PrePush(self, image): """Prepares registry to push a given image.""" repository_name = '{namespace}/{name}'.format( namespace=self.name, name=image.name ) repository = EcrRepository(repository_name, self.region) self.repositories.append(repository) repository.Create()
Prepares registry to push a given image.
PrePush
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_container_service.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_container_service.py
Apache-2.0
def _GetContainerDefinitions(self): """Returns a JSON representation of the container definitions.""" definitions = [{ 'name': self.name, 'image': self.image, 'essential': True, 'portMappings': [{ 'containerPort': self.container_port, 'protocol': 'TCP', ...
Returns a JSON representation of the container definitions.
_GetContainerDefinitions
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_container_service.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_container_service.py
Apache-2.0
def _GetOverrides(self): """Returns a JSON representaion of task overrides. While the container level resources can be overridden, they have no effect on task level resources for Fargate tasks. This means that modifying a container spec will only affect the command of any new containers launched fr...
Returns a JSON representaion of task overrides. While the container level resources can be overridden, they have no effect on task level resources for Fargate tasks. This means that modifying a container spec will only affect the command of any new containers launched from it and not cpu/memory.
_GetOverrides
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_container_service.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_container_service.py
Apache-2.0
def _GetTask(self): """Returns a dictionary representation of the task.""" describe_cmd = util.AWS_PREFIX + [ '--region', self.region, 'ecs', 'describe-tasks', '--cluster', self.cluster_name, '--tasks', self.arn, ] stdout, _, _ = vm_util.Is...
Returns a dictionary representation of the task.
_GetTask
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_container_service.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_container_service.py
Apache-2.0
def WaitForExit(self, timeout=None): """Waits until the task has finished running.""" @vm_util.Retry( timeout=timeout, retryable_exceptions=(container_service.RetriableContainerException,), ) def _WaitForExit(): task = self._GetTask() if task['lastStatus'] != 'STOPPED': ...
Waits until the task has finished running.
WaitForExit
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_container_service.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_container_service.py
Apache-2.0
def GetLogs(self): """Returns the logs from the container.""" assert self.arn is not None task_id = self.arn.split('/')[-1] log_stream = 'pkb/{name}/{task_id}'.format(name=self.name, task_id=task_id) return str( aws_logs.GetLogStreamAsString(self.region, log_stream, 'pkb') )
Returns the logs from the container.
GetLogs
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_container_service.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_container_service.py
Apache-2.0
def _CreateDependencies(self): """Creates the load balancer for the service.""" self.load_balancer.Create() self.target_group.Create() listener = aws_load_balancer.Listener( self.load_balancer, self.target_group, self.port ) listener.Create() self.ip_address = self.load_balancer.dns_...
Creates the load balancer for the service.
_CreateDependencies
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_container_service.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_container_service.py
Apache-2.0
def _GetLoadBalancerConfig(self): """Returns the JSON representation of the service load balancers.""" load_balancer_config = [{ 'targetGroupArn': self.target_group.arn, 'containerName': self.name, 'containerPort': self.container_port, }] return json.dumps(load_balancer_config)
Returns the JSON representation of the service load balancers.
_GetLoadBalancerConfig
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_container_service.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_container_service.py
Apache-2.0
def _Exists(self): """Returns True if the cluster exists.""" if not self.arn: return False describe_cmd = util.AWS_PREFIX + [ '--region', self.region, 'ecs', 'describe-clusters', '--clusters', self.arn, ] stdout, _, _ = vm_util.IssueCommand(descr...
Returns True if the cluster exists.
_Exists
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_container_service.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_container_service.py
Apache-2.0
def DeployContainer(self, name, container_spec): """Deploys the container according to the spec.""" if name not in self.task_defs: task_def = TaskDefinition(name, container_spec, self) self.task_defs[name] = task_def task_def.Create() task = EcsTask(name, container_spec, self) self.con...
Deploys the container according to the spec.
DeployContainer
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_container_service.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_container_service.py
Apache-2.0
def DeployContainerService(self, name, container_spec): """Deploys the container service according to the spec.""" if name not in self.task_defs: task_def = TaskDefinition(name, container_spec, self) self.task_defs[name] = task_def task_def.Create() service = EcsService(name, container_spe...
Deploys the container service according to the spec.
DeployContainerService
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_container_service.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_container_service.py
Apache-2.0
def _IsReady(self): """Returns True if the cluster is ready, else False.""" validate_cmd = [ FLAGS.kops, 'validate', 'cluster', '--name=%s' % self.name, '--state=s3://%s' % self.config_bucket, ] env = os.environ.copy() env['KUBECONFIG'] = FLAGS.kubeconfig ...
Returns True if the cluster is ready, else False.
_IsReady
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_container_service.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_container_service.py
Apache-2.0
def _CreateDependencies(self): """See base class. Creates the IAM role and subnet group used by the DAX cluster. """ self.iam_role.Create() cmd = util.AWS_PREFIX + [ 'dax', 'create-subnet-group', '--subnet-group-name', self.subnet_group_name, '--subnet-ids',...
See base class. Creates the IAM role and subnet group used by the DAX cluster.
_CreateDependencies
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_dax.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_dax.py
Apache-2.0
def _IsReady(self): """See base class. Returns: True if the DAX cluster is ready. """ cmd = util.AWS_PREFIX + [ 'dax', 'describe-clusters', '--cluster-names', self.cluster_name, ] stdout, _, retcode = vm_util.IssueCommand(cmd, raise_on_failure=False) i...
See base class. Returns: True if the DAX cluster is ready.
_IsReady
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_dax.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_dax.py
Apache-2.0
def _PostCreate(self): """See base class. Enables the Dax Port on the security group's inbound rule. """ for security_group in self.vpc.GetSecurityGroups(): if security_group['GroupName'] == 'default': cmd = util.AWS_PREFIX + [ 'ec2', 'authorize-security-group-ingr...
See base class. Enables the Dax Port on the security group's inbound rule.
_PostCreate
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_dax.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_dax.py
Apache-2.0
def EbsDriveIsNvme(machine_type): """Check if the machine type uses NVMe driver.""" instance_family = machine_type.split('.')[0].lower() return instance_family not in NON_EBS_NVME_TYPES or 'metal' in machine_type
Check if the machine type uses NVMe driver.
EbsDriveIsNvme
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_disk.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_disk.py
Apache-2.0
def _Delete(self): """Deletes the disk, as well as all associated snapshot and restore disks.""" if self.snapshots: for snapshot in self.snapshots: snapshot.Delete() delete_cmd = util.AWS_PREFIX + [ 'ec2', 'delete-volume', '--region=%s' % self.region, '--volume-...
Deletes the disk, as well as all associated snapshot and restore disks.
_Delete
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_disk.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_disk.py
Apache-2.0
def _Exists(self): """Returns true if the disk exists.""" describe_cmd = util.AWS_PREFIX + [ 'ec2', 'describe-volumes', '--region=%s' % self.region, '--filter=Name=volume-id,Values=%s' % self.id, ] stdout, _ = util.IssueRetryableCommand(describe_cmd) response = json.l...
Returns true if the disk exists.
_Exists
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_disk.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_disk.py
Apache-2.0
def _WaitForAttachedState(self): """Returns if the state of the disk is attached. Returns: Whether the disk is in an attached state. If not, raises an error. Raises: AwsUnknownStatusError: If an unknown status is returned from AWS. AwsStateRetryableError: If the disk attach is pend...
Returns if the state of the disk is attached. Returns: Whether the disk is in an attached state. If not, raises an error. Raises: AwsUnknownStatusError: If an unknown status is returned from AWS. AwsStateRetryableError: If the disk attach is pending. This is retried.
_WaitForAttachedState
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_disk.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_disk.py
Apache-2.0
def GenerateDeviceLetter(cls, vm_name): """Generates the next available device letter for a given VM.""" with cls._lock: if vm_name not in cls.available_device_letters_by_vm: # AWS allows the following device names: # https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/device_naming.html#a...
Generates the next available device letter for a given VM.
GenerateDeviceLetter
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_disk.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_disk.py
Apache-2.0
def _Attach(self, vm): """Attaches the disk to a VM. Args: vm: The AwsVirtualMachine instance to which the disk will be attached. """ self.device_letter = AwsDisk.GenerateDeviceLetter(vm.name) self.attached_vm_id = vm.id self.attached_vm_name = vm.name device_name = self.GenerateDevi...
Attaches the disk to a VM. Args: vm: The AwsVirtualMachine instance to which the disk will be attached.
_Attach
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_disk.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_disk.py
Apache-2.0
def _Create(self): """Creates a snapshot of the disk. Raises: errors.VmUtil.CalledProcessException: When the command returns a non-zero exit code. """ snapshot_cmd = util.AWS_PREFIX + [ 'ec2', 'create-snapshot', '--volume-id=%s' % self.source_disk_id, '--regi...
Creates a snapshot of the disk. Raises: errors.VmUtil.CalledProcessException: When the command returns a non-zero exit code.
_Create
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_disk.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_disk.py
Apache-2.0
def _Describe(self): """Describe the snapshot, storing the storage size in GB. Returns: float: The time when the snapshot was created. Raises: errors.Resource.RetryableCreationError: If the snapshot is not created and ready. """ if not self.id: raise errors.Resource.C...
Describe the snapshot, storing the storage size in GB. Returns: float: The time when the snapshot was created. Raises: errors.Resource.RetryableCreationError: If the snapshot is not created and ready.
_Describe
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_disk.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_disk.py
Apache-2.0
def GetCreateDiskStrategy( vm: 'virtual_machine.BaseVirtualMachine', disk_spec: aws_disk.AwsDiskSpec, disk_count: int, ) -> disk_strategies.CreateDiskStrategy: """Returns the strategies to create disks for the disk type.""" if disk_spec and disk_count > 0: if disk_spec.disk_type == disk.LOCAL: ...
Returns the strategies to create disks for the disk type.
GetCreateDiskStrategy
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_disk_strategies.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_disk_strategies.py
Apache-2.0
def GetSetupDiskStrategy(self) -> disk_strategies.SetUpDiskStrategy: """Returns the SetUpDiskStrategy for the disk.""" if self.setup_disk_strategy is None: self.setup_disk_strategy = SetUpRemoteDiskStrategy( # pytype: disable=wrong-arg-types self.vm, self.disk_specs ) return self.setu...
Returns the SetUpDiskStrategy for the disk.
GetSetupDiskStrategy
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_disk_strategies.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_disk_strategies.py
Apache-2.0
def UpdateDevicePath(self, scratch_disk): """Updates the paths for all raw devices inside the VM.""" disks = scratch_disk.disks if scratch_disk.is_striped else [scratch_disk] for d in disks: if d.disk_type == disk.NFS: continue device_name = self.GetDeviceByDiskSpecId(d.disk_spec_id) ...
Updates the paths for all raw devices inside the VM.
UpdateDevicePath
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_disk_strategies.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_disk_strategies.py
Apache-2.0
def GetDeviceByDiskSpecId(self, disk_spec_id): """Gets the logged device name by disk_spec_id.""" assert disk_spec_id is not None return self.vm.device_by_disk_spec_id.get(disk_spec_id, None)
Gets the logged device name by disk_spec_id.
GetDeviceByDiskSpecId
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_disk_strategies.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_disk_strategies.py
Apache-2.0
def GetVolumeIdByDevice(self, disk_name): """Gets the logged volume id by disk_name.""" assert disk_name is not None aws_ids = self.vm.disk_identifiers_by_device.get(disk_name, None) assert aws_ids is not None return aws_ids.volume_id
Gets the logged volume id by disk_name.
GetVolumeIdByDevice
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_disk_strategies.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_disk_strategies.py
Apache-2.0
def HasStats(self): """Returns whether there are stats collected for the job run.""" return None not in ( self.memory_gb_hour, self.storage_gb_hour, self.vcpu_hour, )
Returns whether there are stats collected for the job run.
HasStats
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_dpb_emr.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_dpb_emr.py
Apache-2.0
def ComputeJobRunCost(self) -> dpb_service.JobCosts: """Computes the cost of a run for region given this usage.""" if not self.HasStats(): return dpb_service.JobCosts() region_prices = aws_dpb_emr_serverless_prices.EMR_SERVERLESS_PRICES.get( self.region, {} ) memory_gb_hour_price = reg...
Computes the cost of a run for region given this usage.
ComputeJobRunCost
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_dpb_emr.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_dpb_emr.py
Apache-2.0
def _Exists(self): """Check to see whether the cluster exists.""" if not self.cluster_id: return False cmd = self.cmd_prefix + [ 'emr', 'describe-cluster', '--cluster-id', self.cluster_id, ] stdout, _, retcode = vm_util.IssueCommand(cmd, raise_on_failure=False) ...
Check to see whether the cluster exists.
_Exists
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_dpb_emr.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_dpb_emr.py
Apache-2.0
def _IsReady(self): """Check to see if the cluster is ready.""" logging.info('Checking _Ready cluster: %s', self.cluster_id) cmd = self.cmd_prefix + [ 'emr', 'describe-cluster', '--cluster-id', self.cluster_id, ] stdout, _, _ = vm_util.IssueCommand(cmd) result = j...
Check to see if the cluster is ready.
_IsReady
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_dpb_emr.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_dpb_emr.py
Apache-2.0
def _ParseClusterCreateTime( cls, data: dict[str, Any] ) -> tuple[float | None, float | None]: """Parses the cluster create & ready time from an API response dict.""" try: creation_ts = data['Cluster']['Status']['Timeline']['CreationDateTime'] ready_ts = data['Cluster']['Status']['Timeline']...
Parses the cluster create & ready time from an API response dict.
_ParseClusterCreateTime
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_dpb_emr.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_dpb_emr.py
Apache-2.0
def DistributedCopy(self, source, destination, properties=None): """Method to copy data using a distributed job on the cluster.""" job_arguments = ['s3-dist-cp'] job_arguments.append('--src={}'.format(source)) job_arguments.append('--dest={}'.format(destination)) return self.SubmitJob( 'comm...
Method to copy data using a distributed job on the cluster.
DistributedCopy
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_dpb_emr.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_dpb_emr.py
Apache-2.0
def GetHdfsType(self) -> str | None: """Gets human friendly disk type for metric metadata.""" try: return disk_to_hdfs_map[self.spec.worker_group.disk_spec.disk_type] except KeyError: raise errors.Setup.InvalidSetupError( f'Invalid disk_type={self.spec.worker_group.disk_spec.disk_type!...
Gets human friendly disk type for metric metadata.
GetHdfsType
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_dpb_emr.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_dpb_emr.py
Apache-2.0
def _CallGetJobRunApi( self, job_run: _AwsDpbEmrServerlessJobRun ) -> dpb_service.JobResult | None: """Performs EMR Serverless GetJobRun API call.""" cmd = self.cmd_prefix + [ 'emr-serverless', 'get-job-run', '--application-id', job_run.application_id, '--job-run-...
Performs EMR Serverless GetJobRun API call.
_CallGetJobRunApi
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_dpb_emr.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_dpb_emr.py
Apache-2.0
def _FillMetadata(self) -> None: """Gets a dict to initialize this DPB service instance's metadata.""" basic_data = self.metadata dpb_disk_size = self.spec.worker_group.disk_spec.disk_size or 'default' core_count = str(self.spec.emr_serverless_core_count) or 'default' cluster_shape = f'emr-serverle...
Gets a dict to initialize this DPB service instance's metadata.
_FillMetadata
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_dpb_emr.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_dpb_emr.py
Apache-2.0
def _ParseCostMetrics( self, get_job_run_result: dict[Any, Any] ) -> _AwsDpbEmrServerlessJobRun: """Parses usage metrics from an EMR s8s GetJobRun API response.""" resource_utilization = get_job_run_result.get('jobRun', {}).get( 'totalResourceUtilization', {} ) return dataclasses.replace...
Parses usage metrics from an EMR s8s GetJobRun API response.
_ParseCostMetrics
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_dpb_emr.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_dpb_emr.py
Apache-2.0
def _Delete(self): """Deletes Glue Jobs created to avoid quota issues.""" for i in range(self._job_counter): job_name = f'{self.cluster_id}-{i}' self._DeleteGlueJob(job_name)
Deletes Glue Jobs created to avoid quota issues.
_Delete
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_dpb_glue.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_dpb_glue.py
Apache-2.0
def _ComputeJobRunCost( self, dpu_seconds: float | None, max_capacity: float | None, execution_time: float | None, ) -> dpb_service.JobCosts: """Computes the job run cost. If dpu_seconds is not None, then the job run cost will be computed only with that argument. Otherwise max_cap...
Computes the job run cost. If dpu_seconds is not None, then the job run cost will be computed only with that argument. Otherwise max_capacity and execution_time will be used. (This is because DPU seconds are only reported for autoscaling jobs). Currently run costs can only be computed for the us-east-...
_ComputeJobRunCost
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_dpb_glue.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_dpb_glue.py
Apache-2.0
def _GetOptionDecoderConstructions(cls): """Gets decoder classes / constructor args for each configurable option.""" result = super()._GetOptionDecoderConstructions() none_ok = {'default': None, 'none_ok': False} result.update({ 'table_name': (option_decoders.StringDecoder, none_ok), 'bi...
Gets decoder classes / constructor args for each configurable option.
_GetOptionDecoderConstructions
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_dynamodb.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_dynamodb.py
Apache-2.0
def _CreateLocalSecondaryIndex(self) -> List[str]: """Used to create local secondary indexes.""" lsi_items = [] lsi_entry = [] attr_list = [] for lsi in range(0, self.lsi_count): lsi_item = json.dumps({ 'IndexName': f'lsiidx{str(lsi)}', 'KeySchema': [ {'Attrib...
Used to create local secondary indexes.
_CreateLocalSecondaryIndex
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_dynamodb.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_dynamodb.py
Apache-2.0
def _CreateGlobalSecondaryIndex(self) -> List[str]: """Used to create global secondary indexes.""" gsi_items = [] gsi_entry = [] attr_list = [] for gsi in range(0, self.gsi_count): gsi_item = json.dumps({ 'IndexName': f'gsiidx{str(gsi)}', 'KeySchema': [ {'Attr...
Used to create global secondary indexes.
_CreateGlobalSecondaryIndex
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_dynamodb.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_dynamodb.py
Apache-2.0
def IsAutoscaling(self) -> bool: """Returns whether this instance uses (or should use) an autoscaling policy.""" return all([ _AUTOSCALING_CPU_TARGET.value, _AUTOSCALING_MAX_RCU.value, _AUTOSCALING_MAX_WCU.value, ])
Returns whether this instance uses (or should use) an autoscaling policy.
IsAutoscaling
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_dynamodb.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_dynamodb.py
Apache-2.0
def _CreateAutoscalingPolicy( self, scalable_dimension: str, scaling_metric: str, min_capacity: int, max_capacity: int, ) -> None: """Creates an autoscaling policy for the table.""" self._CreateScalableTarget(scalable_dimension, min_capacity, max_capacity) logging.info('Creat...
Creates an autoscaling policy for the table.
_CreateAutoscalingPolicy
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_dynamodb.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_dynamodb.py
Apache-2.0
def _HasAutoscalingPolicies(self) -> bool: """Returns whether autoscaling policies are in effect for this table.""" cmd = util.AWS_PREFIX + [ 'application-autoscaling', 'describe-scaling-policies', '--service-namespace', 'dynamodb', '--resource-id', self._resource...
Returns whether autoscaling policies are in effect for this table.
_HasAutoscalingPolicies
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_dynamodb.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_dynamodb.py
Apache-2.0
def _IsReady(self) -> bool: """Check if dynamodb table is ready.""" logging.info('Getting table ready status for %s', self.table_name) cmd = util.AWS_PREFIX + [ 'dynamodb', 'describe-table', '--region', self.region, '--table-name', self.table_name, ] s...
Check if dynamodb table is ready.
_IsReady
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_dynamodb.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_dynamodb.py
Apache-2.0
def _Exists(self) -> bool: """Returns true if the dynamodb table exists.""" logging.info('Checking if table %s exists', self.table_name) result = self._DescribeTable() if not result: return False if not self.resource_arn: self.resource_arn = result['TableArn'] return True
Returns true if the dynamodb table exists.
_Exists
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_dynamodb.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_dynamodb.py
Apache-2.0
def GetResourceMetadata(self) -> Dict[str, Any]: """Returns a dict containing metadata about the dynamodb instance. Returns: dict mapping string property key to value. """ metadata = { 'aws_dynamodb_billing_mode': self.billing_mode, 'aws_dynamodb_primarykey': self.primary_key, ...
Returns a dict containing metadata about the dynamodb instance. Returns: dict mapping string property key to value.
GetResourceMetadata
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_dynamodb.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_dynamodb.py
Apache-2.0
def SetThroughput( self, rcu: int | None = None, wcu: int | None = None ) -> None: """Updates the table's rcu and wcu.""" if not rcu: rcu = self.rcu if not wcu: wcu = self.wcu current_rcu, current_wcu = self._GetThroughput() if rcu == current_rcu and wcu == current_wcu: log...
Updates the table's rcu and wcu.
SetThroughput
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_dynamodb.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_dynamodb.py
Apache-2.0
def _GetThroughput(self) -> Tuple[int, int]: """Returns the current (rcu, wcu) of the table.""" output = self._DescribeTable()['ProvisionedThroughput'] return output['ReadCapacityUnits'], output['WriteCapacityUnits']
Returns the current (rcu, wcu) of the table.
_GetThroughput
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_dynamodb.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_dynamodb.py
Apache-2.0
def _GetTagResourceCommand(self, tags: Sequence[str]) -> Sequence[str]: """Returns the tag-resource command with the provided tags. This function will retry up to max_retries to allow for instance creation to finish. Args: tags: List of formatted tags to append to the instance. Returns: ...
Returns the tag-resource command with the provided tags. This function will retry up to max_retries to allow for instance creation to finish. Args: tags: List of formatted tags to append to the instance. Returns: A list of arguments for the 'tag-resource' command. Raises: error...
_GetTagResourceCommand
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_dynamodb.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_dynamodb.py
Apache-2.0
def UpdateWithDefaultTags(self) -> None: """Adds default tags to the table.""" tags = util.MakeFormattedDefaultTags() cmd = self._GetTagResourceCommand(tags) logging.info('Setting default tags on table %s', self.table_name) util.IssueRetryableCommand(cmd)
Adds default tags to the table.
UpdateWithDefaultTags
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_dynamodb.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_dynamodb.py
Apache-2.0
def UpdateTimeout(self, timeout_minutes: int) -> None: """Updates the timeout associated with the table.""" tags = util.MakeFormattedDefaultTags(timeout_minutes) cmd = self._GetTagResourceCommand(tags) logging.info( 'Updating timeout tags on table %s with timeout minutes %s', self.table_...
Updates the timeout associated with the table.
UpdateTimeout
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_dynamodb.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_dynamodb.py
Apache-2.0
def _Restore(self) -> None: """See base class. Restores provisioned throughput back to benchmarking levels. """ # Providing flag overrides the capacity used in the previous run. if FLAGS['aws_dynamodb_read_capacity'].present: self.rcu = FLAGS.aws_dynamodb_read_capacity if FLAGS['aws_dynam...
See base class. Restores provisioned throughput back to benchmarking levels.
_Restore
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_dynamodb.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_dynamodb.py
Apache-2.0