How to use _instance_type_to_capability method in lisa

Best Python code snippet using lisa_python

platform_.py

Source:platform_.py Github

copy

Full Screen

...862 log.debug(f"{key}: querying")863 all_skus: List[AwsCapability] = []864 instance_types = ec2_region.describe_instance_types()865 for instance_type in instance_types["InstanceTypes"]:866 capability = self._instance_type_to_capability(location, instance_type)867 # estimate vm cost for priority868 assert isinstance(capability.core_count, int)869 assert isinstance(capability.gpu_count, int)870 estimated_cost = capability.core_count + capability.gpu_count * 100871 aws_capability = AwsCapability(872 location=location,873 vm_size=instance_type["InstanceType"],874 capability=capability,875 resource_sku=instance_type,876 estimated_cost=estimated_cost,877 )878 all_skus.append(aws_capability)879 location_data = AwsLocation(location=location, capabilities=all_skus)880 log.debug(f"{location}: saving to disk")881 with open(cached_file_name, "w") as f:882 json.dump(location_data.to_dict(), f) # type: ignore883 log.debug(f"{key}: new data, " f"sku: {len(location_data.capabilities)}")884 assert location_data885 self._locations_data_cache[key] = location_data886 return location_data887 def _instance_type_to_capability( # noqa: C901888 self, location: str, instance_type: Any889 ) -> schema.NodeSpace:890 # fill in default values, in case no capability meet.891 node_space = schema.NodeSpace(892 node_count=1,893 core_count=0,894 memory_mb=0,895 gpu_count=0,896 )897 instancetype_name: str = instance_type["InstanceType"]898 node_space.name = f"{location}_{instancetype_name}"899 node_space.features = search_space.SetSpace[schema.FeatureSettings](900 is_allow_set=True901 )...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run lisa automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful