diff --git a/sky/optimizer.py b/sky/optimizer.py index bcab7836ee9..0f931e15079 100644 --- a/sky/optimizer.py +++ b/sky/optimizer.py @@ -831,13 +831,17 @@ def format_number(x): return row def _get_resource_group_hash(resources: 'resources_lib.Resources'): - return json.dumps( - { - 'cloud': f'{resources.cloud}', - 'accelerators': f'{resources.accelerators}', - 'use_spot': resources.use_spot - }, - sort_keys=True) + resource_key_dict = { + 'cloud': f'{resources.cloud}', + 'accelerators': f'{resources.accelerators}', + 'use_spot': resources.use_spot + } + if isinstance(resources.cloud, clouds.Kubernetes): + # Region for Kubernetes is the context name, i.e. different + # Kubernetes clusters. We add region to the key to show all the + # Kubernetes clusters in the optimizer table for better UX. + resource_key_dict['region'] = resources.region + return json.dumps(resource_key_dict, sort_keys=True) # Print the list of resouces that the optimizer considered. resource_fields = [