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

fix(powerbi): fix access token expiry #8680

Conversation

elish7lapid
Copy link
Contributor

Powerbi returns an expiry time for the access
token which is currently ignored.
This causes all api calls to fail after 60 minutes, which is the timeout returned by PowerBI.
This commit fixes the bug by creating a new token
once the old one expires.

Checklist

  • The PR conforms to DataHub's Contributing Guideline (particularly Commit Message Format)
  • Links to related issues (if applicable)
  • Tests for the changes have been added/updated (if applicable)
  • Docs related to the changes have been added/updated (if applicable). If a new feature has been added a Usage Guide has been added for the same.
  • For any breaking change/potential downtime/deprecation/big changes an entry has been made in Updating DataHub

Powerbi returns an expiry time for the access
token which is currently ignored.
This causes all api calls to fail after 60 minutes,
which is the timeout returned by PowerBI.
This commit fixes the bug by creating a new token
once the old one expires.
@github-actions github-actions bot added the ingestion PR or Issue related to the ingestion of metadata label Aug 21, 2023
@maggiehays maggiehays added the community-contribution PR or Issue raised by member(s) of DataHub Community label Aug 21, 2023
Copy link
Contributor

@siddiquebagwan-gslab siddiquebagwan-gslab left a comment

Choose a reason for hiding this comment

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

Looks overall good, just one comment

@@ -128,7 +130,7 @@ def get_authorization_header(self):
return {Constant.Authorization: self.get_access_token()}

def get_access_token(self):
if self.__access_token is not None:
if self.__access_token is not None and self.__access_token_expiry_time > datetime.now():
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please put the expiry condition check in a method is_token_expire()

@elish7lapid
Copy link
Contributor Author

@siddiquebagwan-gslab fixed

Copy link
Contributor

@siddiquebagwan-gslab siddiquebagwan-gslab left a comment

Choose a reason for hiding this comment

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

Could you please add a test-case, please refer existing powerbi test-case to mock the client library

Copy link
Contributor

@siddiquebagwan-gslab siddiquebagwan-gslab left a comment

Choose a reason for hiding this comment

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

LGTM

@elish7lapid
Copy link
Contributor Author

@siddiquebagwan-gslab seems that CI is stuck - is there a way to trigger it to run? (I tried to close and reopen the PR but that just removed your approval so now I need you to approve again)

@hsheth2 hsheth2 added the merge-pending-ci A PR that has passed review and should be merged once CI is green. label Sep 12, 2023
@siddiquebagwan-gslab
Copy link
Contributor

@siddiquebagwan-gslab seems that CI is stuck - is there a way to trigger it to run? (I tried to close and reopen the PR but that just removed your approval so now I need you to approve again)

Hi @elish7lapid
Please execute ../gradlew :metadata-ingestion:lintFix from metadata-ingestion directory and fix the lint error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community-contribution PR or Issue raised by member(s) of DataHub Community ingestion PR or Issue related to the ingestion of metadata merge-pending-ci A PR that has passed review and should be merged once CI is green.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants