How to use _get_allowed_capabilities method in lisa

Best Python code snippet using lisa_python

platform_.py

Source:platform_.py Github

copy

Full Screen

...1950 error: str = ""1951 # get allowed vm sizes. Either it's from the runbook defined, or1952 # from subscription supported .1953 for req_index, req in enumerate(nodes_requirement):1954 candidate_caps, sub_error = self._get_allowed_capabilities(1955 req, location, log1956 )1957 if sub_error:1958 # no candidate found, so try next one.1959 error = sub_error1960 continue1961 # filter vm sizes and return two list. 1st is deployable, 2nd is1962 # wait able for released resource.1963 (1964 available_capabilities,1965 awaitable_capabilities,1966 ) = self._parse_cap_availabilities(candidate_caps)1967 # sort vm sizes to match1968 available_capabilities = self.get_sorted_vm_sizes(1969 available_capabilities, log1970 )1971 # match vm sizes by capability or use the predefined vm sizes.1972 candidate_cap = self._get_matched_capability(req, available_capabilities)1973 if candidate_cap:1974 caps[req_index] = candidate_cap1975 else:1976 # the error will be overwritten, if there is vm sizes without1977 # quota.1978 error = f"no available vm size found on '{location}'."1979 if not candidate_cap:1980 # check if there is awaitable VMs1981 candidate_cap = self._get_matched_capability(1982 req, awaitable_capabilities1983 )1984 if candidate_cap:1985 # True means awaitable.1986 caps[req_index] = True1987 error = f"no quota found on '{location}'"1988 return caps, error1989 def _get_allowed_capabilities(1990 self, req: schema.NodeSpace, location: str, log: Logger1991 ) -> Tuple[List[AzureCapability], str]:1992 node_runbook = req.get_extended_runbook(AzureNodeSchema, AZURE)1993 error: str = ""1994 if node_runbook.vm_size:1995 # find the vm_size1996 allowed_vm_sizes = self._get_normalized_vm_sizes(1997 name=node_runbook.vm_size, location=location, log=log1998 )1999 # Some preview vm size may not be queried from the list.2000 # Force to add.2001 if not allowed_vm_sizes:2002 log.debug(2003 f"no vm size matched '{node_runbook.vm_size}' on location "...

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