Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
landscapepainter committed Aug 21, 2024
1 parent befcbc1 commit dc36eab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
5 changes: 3 additions & 2 deletions sky/provision/azure/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,9 @@ def bootstrap_instances(

logger.info(f'Using cluster name: {cluster_name_on_cloud}')

cluster_id = get_cluster_id(resource_group=provider_config['resource_group'],
cluster_name_on_cloud=cluster_name_on_cloud)
cluster_id = get_cluster_id(
resource_group=provider_config['resource_group'],
cluster_name_on_cloud=cluster_name_on_cloud)
subnet_mask = provider_config.get('subnet_mask')
if subnet_mask is None:
# choose a random subnet, skipping most common value of 0
Expand Down
15 changes: 6 additions & 9 deletions sky/provision/azure/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -709,8 +709,7 @@ def _fetch_and_map_status(node, resource_group: str) -> None:
return statuses


def _get_cluster_nsg(network_client: Client,
resource_group: str,
def _get_cluster_nsg(network_client: Client, resource_group: str,
cluster_name_on_cloud: str) -> NetworkSecurityGroup:
"""Retrieve the NSG associated with the given name of the cluster."""
list_network_security_groups = _get_azure_sdk_function(
Expand Down Expand Up @@ -756,7 +755,8 @@ def open_ports(
backoff = common_utils.Backoff(max_backoff_factor=1)
start_time = time.time()
while True:
nsg = _get_cluster_nsg(network_client, resource_group, cluster_name_on_cloud)
nsg = _get_cluster_nsg(network_client, resource_group,
cluster_name_on_cloud)
if nsg.provisioning_state not in ['Creating', 'Updating']:
break
if time.time() - start_time > _WAIT_CREATION_TIMEOUT_SECONDS:
Expand All @@ -773,9 +773,8 @@ def open_ports(
f'{ports} failed.')

backoff_time = backoff.current_backoff()
logger.info(
f'NSG {nsg.name} is not created yet. Waiting for '
f'{backoff_time} seconds before checking again.')
logger.info(f'NSG {nsg.name} is not created yet. Waiting for '
f'{backoff_time} seconds before checking again.')
time.sleep(backoff_time)

# Azure NSG rules have a priority field that determines the order
Expand All @@ -796,9 +795,7 @@ def open_ports(
destination_address_prefix='*',
destination_port_ranges=ports,
))
poller = update_network_security_groups(resource_group,
nsg.name,
nsg)
poller = update_network_security_groups(resource_group, nsg.name, nsg)
poller.wait()
if poller.status() != 'Succeeded':
with ux_utils.print_exception_no_traceback():
Expand Down

0 comments on commit dc36eab

Please sign in to comment.