Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade azure-storage and pass token_credential argument (#3005) #3008

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

vbarbaresi
Copy link
Contributor

@vbarbaresi vbarbaresi commented Oct 12, 2020

Motivation and context

azure-storage==0.36 didn't support token_credential argument in BlockBlobService init.
I upgraded to the new package azure-storage-blob and use the last version that still supports BlockBlobService (it's deprecated, but that can be upgraded another time)

Description

Fixes #3005 by passing token_credential argument.

I also had to explicitely default the protocol to "https", otherwise the initialization fails when we provide a token_credential argument.

I successfully ran azureblob unit tests

…rvice and fix spotify#3005

azure-storage==0.36 didn't support `token_credential` argument in `BlockBlobService` init.
Upgrade to the new package `azure-storage-blob` and use the last version that still supports `BlockBlobService` (it's deprecated,
but that can be upgraded another time)

Fixes spotify#3005 by passing `token_credential` argument.

I also had to explicitely default the protocol to "https", otherwise the initialization fails when we provide a token_credential argument.
Copy link
Collaborator

@dlstadther dlstadther left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have asked for some test cases added, but iirc the Azure stuff was integration tested, not unit tested due to the need to connect to and interact with an actual azure account.

So for now, could you just address the two syntax items below?

luigi/contrib/azureblob.py Outdated Show resolved Hide resolved
luigi/contrib/azureblob.py Outdated Show resolved Hide resolved
@vbarbaresi
Copy link
Contributor Author

gentle bump, could it be merged?

@@ -74,7 +75,8 @@ def connection(self):
connection_string=self.kwargs.get("connection_string"),
endpoint_suffix=self.kwargs.get("endpoint_suffix"),
custom_domain=self.kwargs.get("custom_domain"),
is_emulated=self.kwargs.get("is_emulated") or False)
is_emulated=self.kwargs.get("is_emulated", False),
token_credential=self.kwargs.get("token_credential"))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will azure-storage<=0.36 allow for the passing of token_credential without fail? (even if without impact)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, it immediately fails

>>> blockblobservice.BlockBlobService(account_name="a", token_credential="a")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: __init__() got an unexpected keyword argument 'token_credential'

do you prefer to keep some compatibility in here in case users aren't able to upgrade their packages?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wait, i see the hard update on az dependencies anyway.

So either we make this change, as is, and include it as an explicit breaking change. Or we explore options for enabling both.

I'm not immediately thinking of an easy way to keep compatibility.

azure-storage==0.36 is also from 2017...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can refactor these keyword arguments in a dict, and add token_credential argument only if we're using the new azure package:

from pkg_resources import parse_version
new_azure_package = parse_version(azure.storage.blob.__version__) >= parse_version("2.1.0")

(Under a try/except AttributeError because this attribute didn't exist in the old package, it's azure.storage.__version__ )

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed it in another branch 0566938
I can cherry-pick this here, it's up to you

@stale
Copy link

stale bot commented Jan 9, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If closed, you may revisit when your time allows and reopen! Thank you for your contributions.

@stale stale bot added the wontfix label Jan 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pass token_credential to BlockBlobService
2 participants