-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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(ingest/sagemaker): ensure consistent STS token usage with refresh mechanism #11170
fix(ingest/sagemaker): ensure consistent STS token usage with refresh mechanism #11170
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 as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
64bec67
to
1b4eb42
Compare
1b4eb42
to
e93e5d1
Compare
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.
Thank you for the contribution. I added some comments with regards to particular lines. Would it be possible to add some unit test proving that refreshing didn't work before and works after the change?
metadata-ingestion/src/datahub/ingestion/source/aws/sagemaker_processors/jobs.py
Outdated
Show resolved
Hide resolved
metadata-ingestion/src/datahub/ingestion/source/aws/sagemaker.py
Outdated
Show resolved
Hide resolved
2b53328
to
2050d9e
Compare
2050d9e
to
e0ca73d
Compare
e0ca73d
to
b5cc27e
Compare
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.
Thank you for rearranging the code and testing it. I believe it should work as intended now. I am concerned though with sagemaker_client
field of the jobs.py
losing it's strict type on the way, especially considering isinstance
check against it further down the road it might be hard to maintain this class later.
I would suggest to create a "ClientFactory" class, instantiated in SagemakerSource
. The factor would be initialized with entire config (so that it can have a logic we now use to provide arguments to the JobProcessor
). The JobProcessor
would just receive a factory method which it would call to get client, completely oblivious to the fact that the factory method will return:
- cached credentials if
allowed_cred_refresh()
returnsfalse
(it would hold cache object) - or pass along what
get_sagemaker_client()
method returns in caseallowed_cred_refresh()
returnstrue
This way we avoid changes to the type of sagemaker_client (it would be always a function).
I am approving this PR, but if you have time I am interested as to what do you think about proposed change and maybe you would like to try it?
… conditional refresh handling
Checklist