Skip to content

Commit

Permalink
Fix error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Michaelvll committed Jun 27, 2024
1 parent b018695 commit 044cde0
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions sky/skylet/providers/azure/node_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,21 +83,20 @@ def __init__(self, provider_config, cluster_name):
def _get_filtered_nodes(self, tag_filters):
# add cluster name filter to only get nodes from this cluster
cluster_tag_filters = {**tag_filters, TAG_RAY_CLUSTER_NAME: self.cluster_name}

def match_tags(vm):
for k, v in cluster_tag_filters.items():
if vm.tags.get(k) != v:
return False
return True

try:
vms = self.compute_client.virtual_machines.list(
vms = list(self.compute_client.virtual_machines.list(
resource_group_name=self.provider_config["resource_group"]
)
except azure.exceptions().HttpResponseError as e:
if e.reason == "ResourceGroupNotFound":
logger.debug("Resource group not found. VMs should be " "terminated.")
vms = {}
))
except azure.exceptions().ResourceNotFoundError as e:
if "Code: ResourceGroupNotFound" in e.exc_msg:
logger.debug("Resource group not found. VMs should be terminated.")
vms = []
else:
raise

Expand Down

0 comments on commit 044cde0

Please sign in to comment.