Skip to content

Commit

Permalink
[Performance] Refactor Azure SDK usage (skypilot-org#4139)
Browse files Browse the repository at this point in the history
* [Performance] Refactor Azure SDK usage

* lazy import and address comments

* address comments
  • Loading branch information
yika-luo authored Oct 23, 2024
1 parent f2991b1 commit 8283e4c
Show file tree
Hide file tree
Showing 5 changed files with 174 additions and 388 deletions.
11 changes: 11 additions & 0 deletions sky/adaptors/azure.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,17 @@ def exceptions():
return azure_exceptions


@functools.lru_cache()
@common.load_lazy_modules(modules=_LAZY_MODULES)
def azure_mgmt_models(name: str):
if name == 'compute':
from azure.mgmt.compute import models
return models
elif name == 'network':
from azure.mgmt.network import models
return models


# We should keep the order of the decorators having 'lru_cache' followed
# by 'load_lazy_modules' as we need to make sure a caller can call
# 'get_client.cache_clear', which is a function provided by 'lru_cache'
Expand Down
301 changes: 0 additions & 301 deletions sky/provision/azure/azure-vm-template.json

This file was deleted.

1 change: 1 addition & 0 deletions sky/provision/azure/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def bootstrap_instances(
region: str, cluster_name_on_cloud: str,
config: common.ProvisionConfig) -> common.ProvisionConfig:
"""See sky/provision/__init__.py"""
# TODO: use new azure sdk instead of ARM deployment.
del region # unused
provider_config = config.provider_config
subscription_id = provider_config.get('subscription_id')
Expand Down
Loading

0 comments on commit 8283e4c

Please sign in to comment.