-
Notifications
You must be signed in to change notification settings - Fork 3k
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(ingestion): Fixed STS token refresh mechanism for sagemaker source #11252
base: master
Are you sure you want to change the base?
Conversation
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
return False | ||
@staticmethod | ||
def get_caller_identity(session: Session) -> Optional[str]: | ||
logger.info("Retrieving identity of session: %s", session.profile_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We prefer to use format string instead of parameter if possible
return False | ||
@staticmethod | ||
def get_caller_identity(session: Session) -> Optional[str]: | ||
logger.info("Retrieving identity of session: %s", session.profile_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logger.info("Retrieving identity of session: %s", session.profile_name) | |
logger.info(f"Retrieving identity of session: {session.profile_name}") |
def __repr__(self): | ||
if not self.value_stored: | ||
self.value = self.callback(*self.args) | ||
self.value_stored = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this store mechanism used anywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I missed it, but you are not reusing this anywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is used by DEBUG
logger to avoid costly call to sts if we are not on DEBUG
level. See here:
https://github.com/datahub-project/datahub/pull/11252/files#diff-658ffa764c667e22fae4a46946899527226fa9e0ce7464d35cf56bd4c2a29726R220
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it was more because I saw you cache the value in LazyLogEvalator, but the LazyLogEvaulator instance is never reused.
It is not a problem as it can be useful in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is reused actually. We create it once when log.debug line is hit. Then the repr function is called (assuming DEBUG-level is set) to print to console. And then it is called again (now using the cached value) because beside logging to console we also log to a file if debugging is turned on, so caching is, in fact, used.
@@ -55,9 +61,9 @@ def get_feature_group_details( | |||
""" | |||
Get details of a feature group (including list of component features). | |||
""" | |||
|
|||
logger.debug("Attempting to describe feature group: %s", feature_group_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here as above, please prefer fstrings where possible
return True | ||
return False | ||
@staticmethod | ||
def get_caller_identity(session: Session) -> Optional[str]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this change over time, or can we cache this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic of the ingestor itself does not need it, we extract the caller identity from the session to make sure we acquired correct role (in debug mode only)
Beside change (fix) to
sagemaker
source using new refresh mechanism (also fixed), this PR introduces others - which were needed due to these changes:aws_common
, along with a special class allowing costly session check to be done only while DEBUG-level is turned onglue
source tests due to the above (even thoughglue
source didn't get the same refresh mechanism assagemaker
source, the tests needed to be adjusted)sagemaker
test, of the new mechanismChecklist