1. fix bug that not break when find first matched location
2. fix bug that cost caculated multiple times
3. improve logs
This commit is contained in:
Chi Song 2020-09-15 11:43:15 +08:00
Родитель c9f23c1271
Коммит 9d2b44b42c
2 изменённых файлов: 18 добавлений и 4 удалений

Просмотреть файл

@ -238,9 +238,17 @@ class SetSpace(RequirementMixin, Set[T]):
f"capability: '{capability}', "
)
else:
inter_set = self.intersection(capability)
inter_set: Set[Any] = self.intersection(capability)
if len(inter_set) > 0:
result.add_reason(f"requirements excludes {inter_set}")
names: List[str] = []
for item in inter_set:
if isinstance(item, type):
names.append(item.__name__)
elif isinstance(item, object):
names.append(item.__class__.__name__)
else:
names.append(item)
result.add_reason(f"requirements excludes {names}")
return result
def _generate_min_capability(self, capability: Any) -> Optional[Set[T]]:

Просмотреть файл

@ -276,11 +276,13 @@ class AzurePlatform(Platform):
if existing_location:
locations = [existing_location]
else:
locations = list(self._eligable_capabilities.keys())
locations = LOCATIONS
# check eligab locations
found_or_skipped = False
for location_name in locations:
predefined_cost = 0
predefined_caps = [None] * node_count
for req_index, req in enumerate(nodes_requirement):
found_or_skipped = False
node_runbook = req.get_extended_runbook(AzureNodeSchema, AZURE)
@ -314,10 +316,14 @@ class AzurePlatform(Platform):
if not found_or_skipped:
# if not found any, skip and try next location
break
if found_or_skipped:
# if found all, skip other locations
break
if not found_or_skipped:
# no location meet requirement
raise LisaException(
f"cannot find predefined vm size [{node_runbook.vm_size}]"
f"cannot find predefined vm size [{node_runbook.vm_size}] "
f"in location [{locations}]"
)
for location_name, location_caps in self._eligable_capabilities.items():
# in each location, all node must be found