diff --git a/CHANGELOG.md b/CHANGELOG.md index 0906e14fbe..a9dc410110 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ All notable changes to this project will be documented in this file. ## \[5.7.6\] - Prefix user visible errors with its source. +- Fix accelerator optimized machine type SMT handling. +- Fix accelerator optimized machine type socket handling. ## \[5.7.5\] diff --git a/scripts/util.py b/scripts/util.py index 952fcd9f4b..16002e30be 100755 --- a/scripts/util.py +++ b/scripts/util.py @@ -1067,22 +1067,16 @@ def get_insert_operations(group_ids, flt=None, project=None, compute=compute): def machine_type_sockets(template): - pattern = re.compile("^(?P[^-]+)-(?P[^-]+)-(?P[^-]+)$") + pattern = re.compile("^(?P[^-]+)") m = pattern.match(template.machineType) if not m: raise Exception(f"template {template} does not match expected regex") family = m.group("family") - try: - core_count = int(m.group("core")) - except ValueError: - log.warning( - f"core count in machine type {template.machineType} is not an integer. Default to 1 socket." - ) - return 1 + guestCpus: int = int(template.machine_info.guestCpus) socket_count = dict.get( { "h3": 2, - "c2d": 2 if core_count > 56 else 1, + "c2d": 2 if guestCpus > 56 else 1, }, family, 1, # assume 1 socket for all other families @@ -1092,11 +1086,11 @@ def machine_type_sockets(template): def isSmt(template): machineType: str = template.machineType + guestCpus: int = int(template.machine_info.guestCpus) - pattern = re.compile("^(?P[^-]+)-(?P[^-]+)-(?P[^-]+)$") + pattern = re.compile("^(?P[^-]+)") matches = pattern.match(machineType) machineTypeFamily: str = matches["family"] - machineTypeCore: int = int(matches["core"]) # https://cloud.google.com/compute/docs/cpu-platforms noSmtFamily = [ @@ -1106,7 +1100,7 @@ def isSmt(template): ] if machineTypeFamily in noSmtFamily: return False - elif machineTypeCore == 1: + elif guestCpus == 1: return False return True