Skip to content

Commit

Permalink
create share client every time to make sure token-based authenticatio…
Browse files Browse the repository at this point in the history
…n is up to date
  • Loading branch information
motus committed Jul 23, 2024
1 parent d9bf3fe commit 827492f
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions mlos_bench/mlos_bench/services/remote/azure/azure_fileshare.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,22 @@ def __init__(
"storageFileShareName",
},
)
self._share_client: Optional[ShareClient] = None
self._share_url = self._SHARE_URL.format(
account_name=self.config["storageAccountName"],
fs_name=self.config["storageFileShareName"],
)
assert self._parent is not None and isinstance(
self._parent, SupportsAuth
), "Authorization service not provided. Include service-auth.jsonc?"
self._auth_service: SupportsAuth = self._parent

def _get_share_client(self) -> ShareClient:
"""Get the Azure file share client object."""
if self._share_client is None:
assert self._parent is not None and isinstance(
self._parent, SupportsAuth
), "Authorization service not provided. Include service-auth.jsonc?"
self._share_client = ShareClient.from_share_url(
AzureFileShareService._SHARE_URL.format(
account_name=self.config["storageAccountName"],
fs_name=self.config["storageFileShareName"],
),
credential=self._parent.get_access_token(),
token_intent="backup",
)
return self._share_client
return ShareClient.from_share_url(
self._share_url,
credential=self._auth_service.get_access_token(),
token_intent="backup",
)

def download(
self,
Expand Down

0 comments on commit 827492f

Please sign in to comment.