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 GetResourceMetadata(self): """Returns a dict containing metadata about the instance. Returns: dict mapping string property key to value. """ self.metadata.update({ 'cloud_redis_failover_style': self.failover_style, 'cloud_redis_version': self.GetReadableVersion(), 'clo...
Returns a dict containing metadata about the instance. Returns: dict mapping string property key to value.
GetResourceMetadata
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_elasticache_cluster.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_elasticache_cluster.py
Apache-2.0
def _IsDeleting(self): """Returns True if cluster is being deleted and false otherwise.""" cluster_info = self.DescribeInstance() return cluster_info.get('Status', '') == 'deleting'
Returns True if cluster is being deleted and false otherwise.
_IsDeleting
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_elasticache_cluster.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_elasticache_cluster.py
Apache-2.0
def _IsReady(self): """Returns True if cluster is ready and false otherwise.""" cluster_info = self.DescribeInstance() return cluster_info.get('Status', '') == 'available'
Returns True if cluster is ready and false otherwise.
_IsReady
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_elasticache_cluster.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_elasticache_cluster.py
Apache-2.0
def _Exists(self): """Returns true if the cluster exists and is not being deleted.""" cluster_info = self.DescribeInstance() return 'Status' in cluster_info and cluster_info['Status'] not in [ 'deleting', 'create-failed', ]
Returns true if the cluster exists and is not being deleted.
_Exists
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_elasticache_cluster.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_elasticache_cluster.py
Apache-2.0
def DescribeInstance(self): """Calls describe on cluster. Returns: dict mapping string cluster_info property key to value. """ cmd = [ 'aws', 'elasticache', 'describe-replication-groups', '--region', self.redis_region, '--replication-group-id', ...
Calls describe on cluster. Returns: dict mapping string cluster_info property key to value.
DescribeInstance
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_elasticache_cluster.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_elasticache_cluster.py
Apache-2.0
def _PopulateEndpoint(self): """Populates address and port information from cluster_info. Raises: errors.Resource.RetryableGetError: Failed to retrieve information on cluster """ cluster_info = self.DescribeInstance() if not cluster_info: raise errors.Resource.RetryableGetError( ...
Populates address and port information from cluster_info. Raises: errors.Resource.RetryableGetError: Failed to retrieve information on cluster
_PopulateEndpoint
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_elasticache_cluster.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_elasticache_cluster.py
Apache-2.0
def GetResourceMetadata(self): """Returns a dict containing metadata about the cache cluster. Returns: dict mapping string property key to value. """ self.metadata.update({ 'cloud_memcached_version': self.version, 'cloud_memcached_node_type': self.node_type, }) return self...
Returns a dict containing metadata about the cache cluster. Returns: dict mapping string property key to value.
GetResourceMetadata
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_elasticache_memcached.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_elasticache_memcached.py
Apache-2.0
def DiscoverData(self) -> float: """Runs the AWS Glue Crawler. Returns the time elapsed in secs.""" cmd = util.AWS_PREFIX + [ 'glue', 'start-crawler', '--name', self.crawler_name, '--region', self.region, ] vm_util.IssueCommand(cmd) self._WaitUntilCra...
Runs the AWS Glue Crawler. Returns the time elapsed in secs.
DiscoverData
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_glue_crawler.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_glue_crawler.py
Apache-2.0
def GetMetadata(self) -> Dict[str, Any]: """Return a dictionary of the metadata for this service.""" metadata = super().GetMetadata() metadata.update( aws_glue_crawler_sample_size=self.sample_size, aws_glue_db_name=self.db_name, aws_glue_crawler_name=self.crawler_name, ) retu...
Return a dictionary of the metadata for this service.
GetMetadata
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_glue_crawler.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_glue_crawler.py
Apache-2.0
def _DbExists(self) -> bool | None: """Whether the database exists or not. It might return None if the API call failed with an unknown error. Returns: A bool or None. """ cmd = util.AWS_PREFIX + [ 'glue', 'get-database', '--name', self.db_name, '--regi...
Whether the database exists or not. It might return None if the API call failed with an unknown error. Returns: A bool or None.
_DbExists
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_glue_crawler.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_glue_crawler.py
Apache-2.0
def _CrawlerExists(self) -> bool | None: """Whether the crawler exists or not. It might return None if the API call failed with an unknown error. Returns: A bool or None. """ _, stderr, retcode = self._GetCrawler(raise_on_failure=False) if not retcode: return True return False ...
Whether the crawler exists or not. It might return None if the API call failed with an unknown error. Returns: A bool or None.
_CrawlerExists
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_glue_crawler.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_glue_crawler.py
Apache-2.0
def _GetCrawler(self, raise_on_failure=True) -> Tuple[str, str, int]: """Calls the AWS CLI to retrieve a crawler.""" cmd = util.AWS_PREFIX + [ 'glue', 'get-crawler', '--name', self.crawler_name, '--region', self.region, ] return vm_util.IssueCommand(cmd, r...
Calls the AWS CLI to retrieve a crawler.
_GetCrawler
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_glue_crawler.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_glue_crawler.py
Apache-2.0
def _RoleExists(self): """Returns true if the IAM role exists.""" cmd = util.AWS_PREFIX + ['iam', 'get-role', '--role-name', self.role_name] stdout, _, retcode = vm_util.IssueCommand(cmd, raise_on_failure=False) return retcode == 0 and stdout and json.loads(stdout)['Role']
Returns true if the IAM role exists.
_RoleExists
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_iam_role.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_iam_role.py
Apache-2.0
def _PolicyExists(self): """Returns true if the IAM policy used by the role exists.""" cmd = util.AWS_PREFIX + [ 'iam', 'get-policy', '--policy-arn', self.policy_arn, ] stdout, _, retcode = vm_util.IssueCommand(cmd, raise_on_failure=False) return retcode == 0 and stdo...
Returns true if the IAM policy used by the role exists.
_PolicyExists
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_iam_role.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_iam_role.py
Apache-2.0
def _RunPythonScript(self, args: list[str]) -> tuple[str, str]: """Calls the on-client-vm python script with appropriate arguments. We do this rather than just run the python code in this file to avoid importing the AWS libraries. Args: args: Additional arguments for the python script. Retur...
Calls the on-client-vm python script with appropriate arguments. We do this rather than just run the python code in this file to avoid importing the AWS libraries. Args: args: Additional arguments for the python script. Returns: Tuple of [stdout, stderr].
_RunPythonScript
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_jump_start.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_jump_start.py
Apache-2.0
def _GetPythonScriptCommand(self, args: list[str]) -> str: """Returns the command to run the python script with the given args.""" # When run without the region variable, get the error: # "ARN should be scoped to correct region: us-west-2" cmd = ( f'export AWS_DEFAULT_REGION={self.region} && ' ...
Returns the command to run the python script with the given args.
_GetPythonScriptCommand
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_jump_start.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_jump_start.py
Apache-2.0
def _SendPrompt( self, prompt: str, max_tokens: int, temperature: float, **kwargs: Any ) -> list[str]: """Sends a prompt to the model and returns the response.""" payload = self.model_spec.GetPayload(prompt, max_tokens, temperature) payload_json = json.dumps(payload) out, err = self._RunPythonSc...
Sends a prompt to the model and returns the response.
_SendPrompt
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_jump_start.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_jump_start.py
Apache-2.0
def GetPromptCommand( self, prompt: str, max_tokens: int, temperature: float, **kwargs: Any ) -> str: """Doesn't need to be implemented as _SendPrompt is overridden.""" raise NotImplementedError('Not implemented')
Doesn't need to be implemented as _SendPrompt is overridden.
GetPromptCommand
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_jump_start.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_jump_start.py
Apache-2.0
def _FindNameMatch(out: str, resource_type: str) -> str: """Finds the name of the resource in the output of the python script.""" matches = re.search(f'{resource_type}: <(.+?)>', out) if not matches: raise errors.Resource.CreationError( f'Could not find {resource_type} in python cr...
Finds the name of the resource in the output of the python script.
_FindNameMatch
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_jump_start.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_jump_start.py
Apache-2.0
def _PostCreate(self) -> None: """Adds tags & metadata after creation timing.""" self._AddTags('endpoint', self.endpoint_name) self._AddTags('model', self.model_name) describe_cmd = ( f'aws sagemaker describe-endpoint --region={self.region} ' f'--endpoint-name={self.endpoint_name}' )...
Adds tags & metadata after creation timing.
_PostCreate
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_jump_start.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_jump_start.py
Apache-2.0
def _AddTags(self, resource_type: str, resource_name: str) -> None: """Adds tags to the resource with the given type & name.""" arn = f'arn:aws:sagemaker:{self.region}:{self.account_id}:{resource_type}/{resource_name}' cmd = ( f'aws sagemaker add-tags --region={self.region} --resource-arn={arn} ' ...
Adds tags to the resource with the given type & name.
_AddTags
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_jump_start.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_jump_start.py
Apache-2.0
def GetPayload( self, prompt: str, max_tokens: int, temperature: float ) -> dict[str, Any]: """Returns the payload to send to the model.""" return { 'inputs': [[ {'role': 'user', 'content': prompt}, ]], 'parameters': { 'max_new_tokens': max_tokens, ...
Returns the payload to send to the model.
GetPayload
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_jump_start.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_jump_start.py
Apache-2.0
def __init__(self, vpc, port): """Initializes the TargetGroup object. Args: vpc: AwsVpc object which contains the targets for load balancing. port: The internal port that the load balancer connects to. """ super().__init__() self.arn = None self.region = vpc.region self.name = '...
Initializes the TargetGroup object. Args: vpc: AwsVpc object which contains the targets for load balancing. port: The internal port that the load balancer connects to.
__init__
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_load_balancer.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_load_balancer.py
Apache-2.0
def __init__(self, subnets): """Initializes the LoadBalancer object. Args: subnets: List of AwsSubnet objects. """ super().__init__() self.region = subnets[0].region self.name = 'pkb-%s' % FLAGS.run_uri self.subnet_ids = [subnet.id for subnet in subnets] self.type = 'network' ...
Initializes the LoadBalancer object. Args: subnets: List of AwsSubnet objects.
__init__
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_load_balancer.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_load_balancer.py
Apache-2.0
def Exists(self): """Returns True if the log group exists.""" describe_cmd = util.AWS_PREFIX + [ '--region', self.region, 'logs', 'describe-log-groups', '--log-group-name-prefix', self.name, '--no-paginate', ] stdout, _, _ = vm_util.IssueCommand(de...
Returns True if the log group exists.
Exists
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_logs.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_logs.py
Apache-2.0
def GetLogs(region, stream_name, group_name, token=None): """Fetches the JSON formatted log stream starting at the token.""" get_cmd = util.AWS_PREFIX + [ '--region', region, 'logs', 'get-log-events', '--start-from-head', '--log-group-name', group_name, '--log-stream-...
Fetches the JSON formatted log stream starting at the token.
GetLogs
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_logs.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_logs.py
Apache-2.0
def GetLogStreamAsString(region, stream_name, log_group): """Returns the messages of the log stream as a string.""" log_lines = [] token = None events = [] while token is None or events: response = GetLogs(region, stream_name, log_group, token) events = response['events'] token = response['nextFor...
Returns the messages of the log stream as a string.
GetLogStreamAsString
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_logs.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_logs.py
Apache-2.0
def DescribeCluster(self) -> dict[str, Any]: """Returns the CLI describe output for the cluster.""" cmd = [ 'aws', 'memorydb', 'describe-clusters', '--cluster-name', self.name, '--region', self.redis_region, ] stdout, stderr, retcode = vm_util.Issu...
Returns the CLI describe output for the cluster.
DescribeCluster
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_memorydb.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_memorydb.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 to open in a range. end_port: The last local port to open in a range. If None, only start_port...
Opens a port on the firewall. Args: vm: The BaseVirtualMachine object to open the port for. start_port: The first local port to open in a range. end_port: The last local port to open in a range. If None, only start_port will be opened. source_range: List of source CIDRs to allow for...
AllowPort
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_network.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_network.py
Apache-2.0
def AllowPortInSecurityGroup( self, region, security_group, start_port, end_port=None, source_range=None ): """Opens a port on the firewall for a security group. Args: region: The region of the security group security_group: The security group in which to open the ports start_port: Th...
Opens a port on the firewall for a security group. Args: region: The region of the security group security_group: The security group in which to open the ports start_port: The first local port to open in a range. end_port: The last local port to open in a range. If None, only start_port ...
AllowPortInSecurityGroup
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_network.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_network.py
Apache-2.0
def _RuleExists(self, region, security_group, start_port, end_port, source): """Whether the firewall rule exists in the VPC.""" query_cmd = util.AWS_PREFIX + [ 'ec2', 'describe-security-groups', '--region=%s' % region, '--group-ids=%s' % security_group, '--filters', ...
Whether the firewall rule exists in the VPC.
_RuleExists
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_network.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_network.py
Apache-2.0
def _SetSecurityGroupId(self): """Looks up the VPC default security group.""" groups = self.GetSecurityGroups('default') if len(groups) != 1: raise ValueError( 'Expected one security group, got {} in {}'.format( len(groups), groups ) ) self.default_security_...
Looks up the VPC default security group.
_SetSecurityGroupId
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_network.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_network.py
Apache-2.0
def _EnableDnsHostnames(self): """Sets the enableDnsHostnames attribute of this VPC to True. By default, instances launched in non-default VPCs are assigned an unresolvable hostname. This breaks the hadoop benchmark. Setting the enableDnsHostnames attribute to 'true' on the VPC resolves this. See: ...
Sets the enableDnsHostnames attribute of this VPC to True. By default, instances launched in non-default VPCs are assigned an unresolvable hostname. This breaks the hadoop benchmark. Setting the enableDnsHostnames attribute to 'true' on the VPC resolves this. See: http://docs.aws.amazon.com/AmazonVPC/...
_EnableDnsHostnames
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_network.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_network.py
Apache-2.0
def NextSubnetCidrBlock(self): """Returns the next available /24 CIDR block in this VPC. Each VPC has a 10.0.0.0/16 CIDR block. Each subnet is assigned a /24 within this allocation. Calls to this method return the next unused /24. Returns: A string representing the next available /24 block, ...
Returns the next available /24 CIDR block in this VPC. Each VPC has a 10.0.0.0/16 CIDR block. Each subnet is assigned a /24 within this allocation. Calls to this method return the next unused /24. Returns: A string representing the next available /24 block, in CIDR notation. Raises: Va...
NextSubnetCidrBlock
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_network.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_network.py
Apache-2.0
def _AllowSelfOutBound(self): """Allow outbound connections on all ports in the default security group. Details: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/efa-start.html """ cmd = util.AWS_PREFIX + [ 'ec2', 'authorize-security-group-egress', '--region', self.re...
Allow outbound connections on all ports in the default security group. Details: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/efa-start.html
_AllowSelfOutBound
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_network.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_network.py
Apache-2.0
def AllowVpcPeerInBound(self, peer_vpc): """Allow inbound connections on all ports in the default security group from peer vpc. Args: peer_vpc: AwsVpc. Peer vpc to allow inbound traffic from. """ cmd = util.AWS_PREFIX + [ 'ec2', 'authorize-security-group-ingress', '--regio...
Allow inbound connections on all ports in the default security group from peer vpc. Args: peer_vpc: AwsVpc. Peer vpc to allow inbound traffic from.
AllowVpcPeerInBound
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_network.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_network.py
Apache-2.0
def GetDict(self): """The 'aws ec2 describe-subnets' for this VPC / subnet id. Returns: A dict of the single subnet or an empty dict if there are no subnets. Raises: AssertionError: If there is more than one subnet. """ describe_cmd = util.AWS_PREFIX + [ 'ec2', 'describ...
The 'aws ec2 describe-subnets' for this VPC / subnet id. Returns: A dict of the single subnet or an empty dict if there are no subnets. Raises: AssertionError: If there is more than one subnet.
GetDict
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_network.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_network.py
Apache-2.0
def GetDict(self): """The 'aws ec2 describe-internet-gateways' for this VPC / gateway id. Returns: A dict of the single gateway or an empty dict if there are no gateways. Raises: AssertionError: If there is more than one internet gateway. """ describe_cmd = util.AWS_PREFIX + [ ...
The 'aws ec2 describe-internet-gateways' for this VPC / gateway id. Returns: A dict of the single gateway or an empty dict if there are no gateways. Raises: AssertionError: If there is more than one internet gateway.
GetDict
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_network.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_network.py
Apache-2.0
def Attach(self, vpc_id): """Attaches the internet gateway to the VPC.""" if not self.attached: self.vpc_id = vpc_id attach_cmd = util.AWS_PREFIX + [ 'ec2', 'attach-internet-gateway', '--region=%s' % self.region, '--internet-gateway-id=%s' % self.id, ...
Attaches the internet gateway to the VPC.
Attach
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_network.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_network.py
Apache-2.0
def Detach(self): """Detaches the internet gateway from the VPC.""" def _suppress_failure(stdout, stderr, retcode): """Suppresses Detach failure when internet gateway is in a bad state.""" del stdout # unused if retcode and ( 'InvalidInternetGatewayID.NotFound' in stderr ...
Detaches the internet gateway from the VPC.
Detach
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_network.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_network.py
Apache-2.0
def _suppress_failure(stdout, stderr, retcode): """Suppresses Detach failure when internet gateway is in a bad state.""" del stdout # unused if retcode and ( 'InvalidInternetGatewayID.NotFound' in stderr or 'Gateway.NotAttached' in stderr ): return True return ...
Suppresses Detach failure when internet gateway is in a bad state.
_suppress_failure
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_network.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_network.py
Apache-2.0
def GetDict(self): """Returns an array of the currently existing routes for this VPC.""" describe_cmd = util.AWS_PREFIX + [ 'ec2', 'describe-route-tables', '--region=%s' % self.region, '--filters=Name=vpc-id,Values=%s' % self.vpc_id, ] stdout, _ = util.IssueRetryableComma...
Returns an array of the currently existing routes for this VPC.
GetDict
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_network.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_network.py
Apache-2.0
def RouteExists(self): """Returns true if the 0.0.0.0/0 route already exists.""" route_tables = self.GetDict() if not route_tables: return False for route in route_tables[0].get('Routes', []): if route.get('DestinationCidrBlock') == '0.0.0.0/0': return True return False
Returns true if the 0.0.0.0/0 route already exists.
RouteExists
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_network.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_network.py
Apache-2.0
def CreateRoute(self, internet_gateway_id): """Adds a route to the internet gateway.""" if self.RouteExists(): logging.info('Internet route already exists.') return create_cmd = util.AWS_PREFIX + [ 'ec2', 'create-route', '--region=%s' % self.region, '--route-table...
Adds a route to the internet gateway.
CreateRoute
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_network.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_network.py
Apache-2.0
def GetForRegion(cls, region, vpc_id=None): """Retrieves or creates an _AwsRegionalNetwork. Args: region: string. AWS region name. vpc_id: string. AWS VPC id. Returns: _AwsRegionalNetwork. If an _AwsRegionalNetwork for the same region already exists in the benchmark spec, that inst...
Retrieves or creates an _AwsRegionalNetwork. Args: region: string. AWS region name. vpc_id: string. AWS VPC id. Returns: _AwsRegionalNetwork. If an _AwsRegionalNetwork for the same region already exists in the benchmark spec, that instance is returned. Otherwise, a new _AwsRegion...
GetForRegion
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_network.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_network.py
Apache-2.0
def _get_default_vpc_id(region: str) -> str: """Returns the default VPC ID for the region. Creates a default VPC if one did not exist previously Args: region: Region of the default VPC. Returns: Default VPC ID Raises: UnsupportedConfigError: When default VPC does not exist and cannot be cre...
Returns the default VPC ID for the region. Creates a default VPC if one did not exist previously Args: region: Region of the default VPC. Returns: Default VPC ID Raises: UnsupportedConfigError: When default VPC does not exist and cannot be created.
_get_default_vpc_id
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_network.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_network.py
Apache-2.0
def _get_default_subnet_id(zone: str) -> str: """Returns the default subnet ID for the zone. Creates a default subnet if one did not exist previously Args: zone: Zone of the default subnet. Returns: Default Subnet ID Raises: UnsupportedConfigError: When default subnet does not exist and cannot be...
Returns the default subnet ID for the zone. Creates a default subnet if one did not exist previously Args: zone: Zone of the default subnet. Returns: Default Subnet ID Raises: UnsupportedConfigError: When default subnet does not exist and cannot be created.
_get_default_subnet_id
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_network.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_network.py
Apache-2.0
def _is_placement_group_compatible(machine_type): """Returns True if VMs of 'machine_type' can be put in a placement group.""" prefix = machine_type.split('.')[0] return prefix not in NON_PLACEMENT_GROUP_PREFIXES
Returns True if VMs of 'machine_type' can be put in a placement group.
_is_placement_group_compatible
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_network.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_network.py
Apache-2.0
def __init__(self, spec): """Initializes AwsNetwork instances. Args: spec: An AwsNetworkSpec object. """ super().__init__(spec) self.region = util.GetRegionFromZone(spec.zone) self.regional_network = _AwsRegionalNetwork.GetForRegion( self.region, spec.vpc_id ) self.subnet ...
Initializes AwsNetwork instances. Args: spec: An AwsNetworkSpec object.
__init__
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_network.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_network.py
Apache-2.0
def _GetNetworkSpecFromVm(vm): """Returns an AwsNetworkSpec created from VM attributes and flags.""" if _AWS_SUBNET.value == 'default': vpc_id = _get_default_vpc_id(vm.region) subnet_id = _get_default_subnet_id(vm.zone) else: vpc_id = _AWS_VPC.value subnet_id = _AWS_SUBNET.value ...
Returns an AwsNetworkSpec created from VM attributes and flags.
_GetNetworkSpecFromVm
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_network.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_network.py
Apache-2.0
def Peer(self, peering_network): """Peers the network with the peering_network. This method is used for VPC peering. It will connect 2 VPCs together. Args: peering_network: BaseNetwork. The network to peer with. """ # Skip Peering if the networks are the same if self.regional_network is...
Peers the network with the peering_network. This method is used for VPC peering. It will connect 2 VPCs together. Args: peering_network: BaseNetwork. The network to peer with.
Peer
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_network.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_network.py
Apache-2.0
def _Create(self): """Creates the peering object. Documentation on creating a vpc object: https://docs.aws.amazon.com/vpc/latest/peering/vpc-pg.pdf """ # Creates Peering Connection create_cmd = util.AWS_PREFIX + [ 'ec2', 'create-vpc-peering-connection', '--region=%s' % s...
Creates the peering object. Documentation on creating a vpc object: https://docs.aws.amazon.com/vpc/latest/peering/vpc-pg.pdf
_Create
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_network.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_network.py
Apache-2.0
def _Delete(self): """Creates the deletes the peering object.""" delete_cmd = util.AWS_PREFIX + [ 'ec2', 'delete-vpc-peering-connection', '--region=%s' % self.network_a.region, '--vpc-peering-connection-id=%s' % self.id, ] vm_util.IssueCommand(delete_cmd)
Creates the deletes the peering object.
_Delete
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_network.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_network.py
Apache-2.0
def _CreateMount(self): """Creates an NFS mount point on an EFS service.""" if self.mount_id: logging.warning('_CreateMount() already called for %s', self.mount_id) return if not self.filer_id: raise errors.Resource.CreationError('Did not create a filer first') logging.info('Creating N...
Creates an NFS mount point on an EFS service.
_CreateMount
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_nfs_service.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_nfs_service.py
Apache-2.0
def _DeleteFiler(self): """Deletes the EFS service. Raises: RetryableDeletionError: If the mount point exists. """ if not self.filer_id: return if self.mount_id: # this isn't retryable as the mount point wasn't deleted raise errors.Resource.RetryableDeletionError( ...
Deletes the EFS service. Raises: RetryableDeletionError: If the mount point exists.
_DeleteFiler
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_nfs_service.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_nfs_service.py
Apache-2.0
def GetFiler(self, token): """Returns the filer using the creation token or None.""" args = ['describe-file-systems', '--creation-token', token] response = self._IssueAwsCommand(args) file_systems = response['FileSystems'] if not file_systems: return None assert len(file_systems) < 2, 'Too...
Returns the filer using the creation token or None.
GetFiler
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_nfs_service.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_nfs_service.py
Apache-2.0
def __init__(self, aws_placement_group_spec): """Init method for AwsPlacementGroup. Args: aws_placement_group_spec: Object containing the information needed to create an AwsPlacementGroup. """ super().__init__(aws_placement_group_spec) self.name = 'perfkit-%s-%s' % (FLAGS.run_uri, str...
Init method for AwsPlacementGroup. Args: aws_placement_group_spec: Object containing the information needed to create an AwsPlacementGroup.
__init__
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_placement_group.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_placement_group.py
Apache-2.0
def _Exists(self): """Returns true if the Placement Group exists.""" describe_cmd = util.AWS_PREFIX + [ 'ec2', 'describe-placement-groups', '--region=%s' % self.region, '--filter=Name=group-name,Values=%s' % self.name, ] stdout, _ = util.IssueRetryableCommand(describe_cmd...
Returns true if the Placement Group exists.
_Exists
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_placement_group.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_placement_group.py
Apache-2.0
def GetResourceMetadata(self): """Returns the metadata associated with the resource. All keys will be prefaced with relational_db before being published (done in publisher.py). Returns: metadata: dict of AWS Managed DB metadata. """ metadata = super().GetResourceMetadata() if hasatt...
Returns the metadata associated with the resource. All keys will be prefaced with relational_db before being published (done in publisher.py). Returns: metadata: dict of AWS Managed DB metadata.
GetResourceMetadata
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_rds_db.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_rds_db.py
Apache-2.0
def _SetEndpoint(self): """Assigns the ports and endpoints from the instance_id to self. These will be used to communicate with the data base. """ json_output = self._DescribeInstance(self.instance_id) self.endpoint = json_output['DBInstances'][0]['Endpoint']['Address']
Assigns the ports and endpoints from the instance_id to self. These will be used to communicate with the data base.
_SetEndpoint
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_rds_db.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_rds_db.py
Apache-2.0
def _IsReady(self, timeout=IS_READY_TIMEOUT): """Return true if the underlying resource is ready. This method will query all of the instance every 5 seconds until its instance state is 'available', or until a timeout occurs. Args: timeout: timeout in seconds Returns: True if the resou...
Return true if the underlying resource is ready. This method will query all of the instance every 5 seconds until its instance state is 'available', or until a timeout occurs. Args: timeout: timeout in seconds Returns: True if the resource was ready in time, False if the wait timed out ...
_IsReady
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_relational_db.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_relational_db.py
Apache-2.0
def _CreateDependencies(self): """Method that will be called once before _CreateResource() is called. Supplying this method is optional. It is intended to allow additional flexibility in creating resource dependencies separately from _Create(). """ # Database subnets requires at least one ore more ...
Method that will be called once before _CreateResource() is called. Supplying this method is optional. It is intended to allow additional flexibility in creating resource dependencies separately from _Create().
_CreateDependencies
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_relational_db.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_relational_db.py
Apache-2.0
def _CreateSubnetInZone(self, new_subnet_zone): """Creates a new subnet in the same region as the client VM. Args: new_subnet_zone: The zone for the subnet to be created. Must be in the same region as the client Returns: the new subnet resource """ cidr = self.client_vm.network...
Creates a new subnet in the same region as the client VM. Args: new_subnet_zone: The zone for the subnet to be created. Must be in the same region as the client Returns: the new subnet resource
_CreateSubnetInZone
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_relational_db.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_relational_db.py
Apache-2.0
def _CreateDbSubnetGroup(self, subnets): """Creates a new db subnet group. Args: subnets: a list of strings. The db subnet group will consit of all subnets in this list. """ db_subnet_group_name = 'pkb-db-subnet-group-{}'.format(FLAGS.run_uri) create_db_subnet_group_cmd = util.AWS_PR...
Creates a new db subnet group. Args: subnets: a list of strings. The db subnet group will consit of all subnets in this list.
_CreateDbSubnetGroup
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_relational_db.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_relational_db.py
Apache-2.0
def _GetParameterGroupFamily(self): """Get the parameter group family string. Parameter group family is formatted as engine type plus version. Returns: ParameterGroupFamiliy name of rds resources. Raises: NotImplementedError: If there is no supported ParameterGroupFamiliy. """ all...
Get the parameter group family string. Parameter group family is formatted as engine type plus version. Returns: ParameterGroupFamiliy name of rds resources. Raises: NotImplementedError: If there is no supported ParameterGroupFamiliy.
_GetParameterGroupFamily
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_relational_db.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_relational_db.py
Apache-2.0
def _TeardownNetworking(self): """Tears down all network resources that were created for the database.""" for subnet_for_db in self.subnets_created: subnet_for_db.Delete() if hasattr(self, 'db_subnet_group_name') and self.db_subnet_group_name: delete_db_subnet_group_cmd = util.AWS_PREFIX + [ ...
Tears down all network resources that were created for the database.
_TeardownNetworking
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_relational_db.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_relational_db.py
Apache-2.0
def _TeardownParameterGroup(self): """Tears down all parameter group that were created for the database.""" if self.parameter_group: delete_db_parameter_group_cmd = util.AWS_PREFIX + [ 'rds', 'delete-db-parameter-group', '--db-parameter-group-name', self.parameter_g...
Tears down all parameter group that were created for the database.
_TeardownParameterGroup
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_relational_db.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_relational_db.py
Apache-2.0
def _IsInstanceReady(self, instance_id, timeout=IS_READY_TIMEOUT): """Return true if the instance is ready. This method will query the instance every 5 seconds until its instance state is 'available', or until a timeout occurs. Args: instance_id: string of the instance to check is ready ti...
Return true if the instance is ready. This method will query the instance every 5 seconds until its instance state is 'available', or until a timeout occurs. Args: instance_id: string of the instance to check is ready timeout: timeout in seconds Returns: True if the resource was rea...
_IsInstanceReady
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_relational_db.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_relational_db.py
Apache-2.0
def _Reboot(self): """Reboot the database and wait until the database is in ready state.""" # Can only reboot when the instance is in ready state if not self._IsInstanceReady(self.instance_id, timeout=IS_READY_TIMEOUT): raise RuntimeError('Instance is not in a state that can reboot') cmd = util.A...
Reboot the database and wait until the database is in ready state.
_Reboot
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_relational_db.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_relational_db.py
Apache-2.0
def _InstanceExists(self, instance_id) -> bool: """Returns true if the underlying instance.""" json_output = self._DescribeInstance(instance_id) if not json_output: return False return True
Returns true if the underlying instance.
_InstanceExists
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_relational_db.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_relational_db.py
Apache-2.0
def _Exists(self): """Returns true if the underlying resource exists. Supplying this method is optional. If it is not implemented then the default is to assume success when _Create and _Delete do not raise exceptions. """ for current_instance_id in self.all_instance_ids: exists = self._In...
Returns true if the underlying resource exists. Supplying this method is optional. If it is not implemented then the default is to assume success when _Create and _Delete do not raise exceptions.
_Exists
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_relational_db.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_relational_db.py
Apache-2.0
def _Delete(self): """Deletes the underlying resource. Implementations of this method should be idempotent since it may be called multiple times, even if the resource has already been deleted. """ @vm_util.Retry( poll_interval=60, fuzz=0, timeout=3600, retryable...
Deletes the underlying resource. Implementations of this method should be idempotent since it may be called multiple times, even if the resource has already been deleted.
_Delete
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_relational_db.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_relational_db.py
Apache-2.0
def _Create(self): """Handles AWS resources provision. It creates an AWS SQS queue. """ cmd = util.AWS_PREFIX + [ 'sqs', 'create-queue', '--queue-name', self.queue_name, '--region', self.region, ] vm_util.IssueCommand(cmd)
Handles AWS resources provision. It creates an AWS SQS queue.
_Create
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_sqs.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_sqs.py
Apache-2.0
def _Exists(self) -> bool: """Checks whether SQS queue already exists.""" cmd = util.AWS_PREFIX + [ 'sqs', 'get-queue-url', '--queue-name', self.queue_name, '--region', self.region, ] _, _, retcode = vm_util.IssueCommand(cmd, raise_on_failure=False) re...
Checks whether SQS queue already exists.
_Exists
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_sqs.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_sqs.py
Apache-2.0
def Run( self, benchmark_scenario: str, number_of_messages: int, message_size: int, warmup_messages: int, streaming_pull: bool = False, ) -> Dict[str, Any]: """Runs remote commands on client VM - benchmark's run phase.""" if streaming_pull: raise ValueError('Unsupport...
Runs remote commands on client VM - benchmark's run phase.
Run
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_sqs.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_sqs.py
Apache-2.0
def _GetQueue(self) -> str: """Get SQS queue URL from AWS.""" cmd = util.AWS_PREFIX + [ 'sqs', 'get-queue-url', '--queue-name', self.queue_name, '--region', self.region, ] stdout, _, _ = vm_util.IssueCommand(cmd) return json.loads(stdout)['QueueUrl']
Get SQS queue URL from AWS.
_GetQueue
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_sqs.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_sqs.py
Apache-2.0
def GetRootBlockDeviceSpecForImage(image_id, region): """Queries the CLI and returns the root block device specification as a dict. Args: image_id: The EC2 image id to query region: The EC2 region in which the image resides Returns: The root block device specification as returned by the AWS cli, ...
Queries the CLI and returns the root block device specification as a dict. Args: image_id: The EC2 image id to query region: The EC2 region in which the image resides Returns: The root block device specification as returned by the AWS cli, as a Python dict. If the image is not found, or if the res...
GetRootBlockDeviceSpecForImage
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_virtual_machine.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_virtual_machine.py
Apache-2.0
def GetBlockDeviceMap(vm): """Returns the block device map to expose all devices for a given machine. Args: vm: vm to build the block device map for. Returns: The json representation of the block device map. If self.boot_disk_size and self.image are provided, the block device map will include th...
Returns the block device map to expose all devices for a given machine. Args: vm: vm to build the block device map for. Returns: The json representation of the block device map. If self.boot_disk_size and self.image are provided, the block device map will include the specification for the root vol...
GetBlockDeviceMap
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_virtual_machine.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_virtual_machine.py
Apache-2.0
def GetArmArchitecture(machine_type: str): """Returns the specific ARM processor architecture of the VM.""" # c6g.medium -> c6g, m6gd.large -> m6g, c5n.18xlarge -> c5 prefix = re.split(r'[dn]?\.', machine_type)[0] return _MACHINE_TYPE_PREFIX_TO_ARM_ARCH.get(prefix)
Returns the specific ARM processor architecture of the VM.
GetArmArchitecture
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_virtual_machine.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_virtual_machine.py
Apache-2.0
def GetProcessorArchitecture(machine_type): """Returns the processor architecture of the VM.""" if GetArmArchitecture(machine_type): return ARM else: return X86
Returns the processor architecture of the VM.
GetProcessorArchitecture
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_virtual_machine.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_virtual_machine.py
Apache-2.0
def ImportKeyfile(cls, region): """Imports the public keyfile to AWS.""" with cls._lock: if _GetKeyfileSetKey(region) in cls.imported_keyfile_set: return cat_cmd = ['cat', vm_util.GetPublicKeyPath()] keyfile, _ = vm_util.IssueRetryableCommand(cat_cmd) formatted_tags = util.Format...
Imports the public keyfile to AWS.
ImportKeyfile
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_virtual_machine.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_virtual_machine.py
Apache-2.0
def DeleteKeyfile(cls, region): """Deletes the imported keyfile for a region.""" with cls._lock: if _GetKeyfileSetKey(region) in cls.deleted_keyfile_set: return delete_cmd = util.AWS_PREFIX + [ 'ec2', '--region=%s' % region, 'delete-key-pair', '--key-n...
Deletes the imported keyfile for a region.
DeleteKeyfile
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_virtual_machine.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_virtual_machine.py
Apache-2.0
def __init__(self, vm_spec): """Initialize a AWS virtual machine. Args: vm_spec: virtual_machine.BaseVirtualMachineSpec object of the vm. Raises: ValueError: If an incompatible vm_spec is passed. """ super().__init__(vm_spec) assert isinstance(self.zone, str) self.region = util...
Initialize a AWS virtual machine. Args: vm_spec: virtual_machine.BaseVirtualMachineSpec object of the vm. Raises: ValueError: If an incompatible vm_spec is passed.
__init__
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_virtual_machine.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_virtual_machine.py
Apache-2.0
def GetDefaultImage(cls, machine_type, region): """Returns the default image given the machine type and region. If specified, the aws_image_name_filter and aws_image_name_regex flags will override os_type defaults. Args: machine_type: The machine_type of the VM, used to determine virtualization ...
Returns the default image given the machine type and region. If specified, the aws_image_name_filter and aws_image_name_regex flags will override os_type defaults. Args: machine_type: The machine_type of the VM, used to determine virtualization type. region: The region of the VM, as im...
GetDefaultImage
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_virtual_machine.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_virtual_machine.py
Apache-2.0
def _RunDescribeInstancesCommand(self): """Runs the describe-instances command and return the response as JSON.""" describe_cmd = util.AWS_PREFIX + [ 'ec2', 'describe-instances', '--region=%s' % self.region, '--filter=Name=client-token,Values=%s' % self.client_token, ] st...
Runs the describe-instances command and return the response as JSON.
_RunDescribeInstancesCommand
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_virtual_machine.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_virtual_machine.py
Apache-2.0
def _ConfigureEfa(self, instance): """Configuare EFA and associate Elastic IP. Args: instance: dict which contains instance info. """ if FLAGS.aws_efa_count > 1: self._ConfigureElasticIp(instance) else: self.ip_address = instance['PublicIpAddress'] if FLAGS.aws_efa_version: ...
Configuare EFA and associate Elastic IP. Args: instance: dict which contains instance info.
_ConfigureEfa
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_virtual_machine.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_virtual_machine.py
Apache-2.0
def _ConfigureElasticIp(self, instance): """Create and associate Elastic IP. Args: instance: dict which contains instance info. """ network_interface_id = None for network_interface in instance['NetworkInterfaces']: # The primary network interface (eth0) for the instance. if netwo...
Create and associate Elastic IP. Args: instance: dict which contains instance info.
_ConfigureElasticIp
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_virtual_machine.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_virtual_machine.py
Apache-2.0
def _InstallEfa(self): """Installs AWS EFA packages. See https://aws.amazon.com/hpc/efa/ """ if not self.TryRemoteCommand('ulimit -l | grep unlimited'): self.RemoteCommand( f'echo "{self.user_name} - memlock unlimited" | ' 'sudo tee -a /etc/security/limits.conf' ) se...
Installs AWS EFA packages. See https://aws.amazon.com/hpc/efa/
_InstallEfa
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_virtual_machine.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_virtual_machine.py
Apache-2.0
def _WaitForStoppedStatus(self): """Returns the status of the VM. Returns: Whether the VM is suspended i.e. in a stopped status. If not, raises an error Raises: AwsUnknownStatusError: If an unknown status is returned from AWS. AwsTransitionalVmRetryableError: If the VM is pending. ...
Returns the status of the VM. Returns: Whether the VM is suspended i.e. in a stopped status. If not, raises an error Raises: AwsUnknownStatusError: If an unknown status is returned from AWS. AwsTransitionalVmRetryableError: If the VM is pending. This is retried.
_WaitForStoppedStatus
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_virtual_machine.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_virtual_machine.py
Apache-2.0
def _BeforeSuspend(self): """Prepares the instance for suspend by having the VM sleep for a given duration. This ensures the VM is ready for hibernation """ # Add a timer that waits for a given duration after vm instance is # created before calling suspend on the vm to ensure that the vm is # r...
Prepares the instance for suspend by having the VM sleep for a given duration. This ensures the VM is ready for hibernation
_BeforeSuspend
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_virtual_machine.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_virtual_machine.py
Apache-2.0
def _WaitForNewIP(self): """Checks for a new IP address, waiting if the VM is still pending. Raises: AwsTransitionalVmRetryableError: If VM is pending. This is retried. """ response = self._RunDescribeInstancesCommand() instance = response['Reservations'][0]['Instances'][0] if 'PublicIpAd...
Checks for a new IP address, waiting if the VM is still pending. Raises: AwsTransitionalVmRetryableError: If VM is pending. This is retried.
_WaitForNewIP
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_virtual_machine.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_virtual_machine.py
Apache-2.0
def _WaitUntilRunning(self): """Waits until the VM is running. This method waits until the VM is no longer pending. Raises: AwsUnknownStatusError: If an unknown status is returned from AWS. AwsTransitionalVmRetryableError: If the VM is pending. This is retried. AwsVmNotCreatedError: If t...
Waits until the VM is running. This method waits until the VM is no longer pending. Raises: AwsUnknownStatusError: If an unknown status is returned from AWS. AwsTransitionalVmRetryableError: If the VM is pending. This is retried. AwsVmNotCreatedError: If the VM does not have a create_start_t...
_WaitUntilRunning
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_virtual_machine.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_virtual_machine.py
Apache-2.0
def SetDiskSpec(self, disk_spec, disk_count): """Sets Disk Specs of the current VM. Calls before the VM is created.""" self.create_disk_strategy = aws_disk_strategies.GetCreateDiskStrategy( self, disk_spec, disk_count )
Sets Disk Specs of the current VM. Calls before the VM is created.
SetDiskSpec
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_virtual_machine.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_virtual_machine.py
Apache-2.0
def LogDeviceByName(self, device_name, volume_id, path=None): """Records disk identifiers to device name for lookup.""" aws_ids = aws_disk.AWSDiskIdentifiers(volume_id=volume_id, path=path) self.disk_identifiers_by_device[device_name] = aws_ids
Records disk identifiers to device name for lookup.
LogDeviceByName
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_virtual_machine.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_virtual_machine.py
Apache-2.0
def DownloadPreprovisionedData( self, install_path, module_name, filename, timeout=virtual_machine.PREPROVISIONED_DATA_TIMEOUT, ): """Downloads a data file from an AWS S3 bucket with pre-provisioned data. Use --aws_preprovisioned_data_bucket to specify the name of the bucket. ...
Downloads a data file from an AWS S3 bucket with pre-provisioned data. Use --aws_preprovisioned_data_bucket to specify the name of the bucket. Args: install_path: The install path on this VM. module_name: Name of the module associated with this data file. filename: The name of the file that ...
DownloadPreprovisionedData
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_virtual_machine.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_virtual_machine.py
Apache-2.0
def ShouldDownloadPreprovisionedData(self, module_name, filename): """Returns whether or not preprovisioned data is available.""" if aws_flags.AWS_PREPROVISIONED_DATA_BUCKET.value: # Guaranteed by flag validation assert self.instance_profile self.InstallCli() return self.TryRemoteCommand...
Returns whether or not preprovisioned data is available.
ShouldDownloadPreprovisionedData
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_virtual_machine.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_virtual_machine.py
Apache-2.0
def GetResourceMetadata(self): """Returns a dict containing metadata about the VM. Returns: dict mapping string property key to value. """ result = super().GetResourceMetadata() result['boot_disk_type'] = self.DEFAULT_ROOT_DISK_TYPE result['boot_disk_size'] = self.boot_disk_size if se...
Returns a dict containing metadata about the VM. Returns: dict mapping string property key to value.
GetResourceMetadata
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_virtual_machine.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_virtual_machine.py
Apache-2.0
def __init__(self, vm_spec): """Initialize a AmazonLinux2 Base DLAMI virtual machine. Args: vm_spec: virtual_machine.BaseVirtualMachineSpec object of the vm. Raises: ValueError: If an incompatible vm_spec is passed. """ super().__init__(vm_spec) # Add preinstalled packages for Deep...
Initialize a AmazonLinux2 Base DLAMI virtual machine. Args: vm_spec: virtual_machine.BaseVirtualMachineSpec object of the vm. Raises: ValueError: If an incompatible vm_spec is passed.
__init__
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_virtual_machine.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_virtual_machine.py
Apache-2.0
def UpdateDockerfile(self, dockerfile): """Add provider specific instructions to a docker file.""" installation_script = r"""RUN apt-get update RUN curl -O https://efa-installer.amazonaws.com/aws-efa-installer-1.37.0.tar.gz RUN tar -xf aws-efa-installer-1.37.0.tar.gz && cd aws-efa-installer && ./efa_installer.s...
Add provider specific instructions to a docker file.
UpdateDockerfile
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_virtual_machine.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_virtual_machine.py
Apache-2.0
def _PostCreate(self): """Retrieve generic VM info and then retrieve the VM's password.""" super()._PostCreate() # Get the decoded password data. decoded_password_data = self._GetDecodedPasswordData() # Write the encrypted data to a file, and use openssl to # decrypt the password. with vm_...
Retrieve generic VM info and then retrieve the VM's password.
_PostCreate
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/providers/aws/aws_virtual_machine.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/aws/aws_virtual_machine.py
Apache-2.0