diff --git a/sky/adaptors/azure.py b/sky/adaptors/azure.py index 4b5e075800f..80ca831a7b9 100644 --- a/sky/adaptors/azure.py +++ b/sky/adaptors/azure.py @@ -69,7 +69,9 @@ def exceptions(): @functools.lru_cache() @common.load_lazy_modules(modules=_LAZY_MODULES) -def get_client(name: str, subscription_id: Optional[str] = None, **kwargs) -> Client: +def get_client(name: str, + subscription_id: Optional[str] = None, + **kwargs) -> Client: """Creates and returns an Azure client for the specified service. Args: @@ -127,8 +129,8 @@ def get_client(name: str, subscription_id: Optional[str] = None, **kwargs) -> Cl # Note: Checking a private container without credentials is # faster (~0.2s) than checking a public container with # credentials (~90s). - from azure.storage import blob from azure.mgmt import storage + from azure.storage import blob container_url = kwargs.pop('container_url', None) assert container_url is not None, ('Must provide container_url' ' keyword arguments for ' @@ -146,13 +148,12 @@ def get_client(name: str, subscription_id: Optional[str] = None, **kwargs) -> Cl credential, subscription_id) storage_account_availability = ( storage_client.storage_accounts.check_name_availability( - {"name": storage_account_name})) + {'name': storage_account_name})) if storage_account_availability.name_available: with ux_utils.print_exception_no_traceback(): raise sky_exceptions.NonExistentStorageAccountError( f'The storage account {storage_account_name!r} does ' - 'not exist. Please check if the name is correct and ' - 'the account is created.') + 'not exist. Please check if the name is correct.') # First, assume the URL is from a public container. container_client = blob.ContainerClient.from_container_url( diff --git a/sky/adaptors/common.py b/sky/adaptors/common.py index 042181d6fe4..5bcdaab9a4b 100644 --- a/sky/adaptors/common.py +++ b/sky/adaptors/common.py @@ -60,7 +60,6 @@ def wrapper(*args, **kwargs): m.load_module() return func(*args, **kwargs) - return wrapper return decorator diff --git a/sky/cloud_stores.py b/sky/cloud_stores.py index c0542c19415..ee1b051d32b 100644 --- a/sky/cloud_stores.py +++ b/sky/cloud_stores.py @@ -236,17 +236,16 @@ def is_directory(self, url: str) -> bool: storage_account_name=storage_account_name, resource_group_name=resource_group_name, refresh_client=refresh_client) - + if not container_client.exists(): with ux_utils.print_exception_no_traceback(): raise sky_exceptions.StorageBucketGetError( f'The provided container {container_name!r} from the ' f'passed endpoint url {url!r} does not exist. Please ' - 'check if the name is correct and the container is ' - 'created.') - + 'check if the name is correct.') + # If there aren't more than just container name and storage account, - # that's a directory. + # that's a directory. # Note: This must be ran after existence of the storage account is # checked while obtaining container client. if not path: