Repository navigation
fix: handle clients without _user_agent_creator in ModelBuilder.build - #6604
Open
themanoj-025 wants to merge 1 commit into
Open
themanoj-025 wants to merge 1 commit into
themanoj-025 wants to merge 1 commit into
Conversation
Signed-off-by: Manoj Jana <[email protected]>
1 of 2 tasks
themanoj-025
requested a deployment
to
manual-approval
November 27, 2026 22:17 — with
GitHub Actions
Waiting
themanoj-025
requested a deployment
to
manual-approval
November 27, 2026 22:17 — with
GitHub Actions
Waiting
themanoj-025
requested a deployment
to
manual-approval
November 27, 2026 22:17 — with
GitHub Actions
Waiting
This branch is waiting to be deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of changes
In \ModelBuilder._build_single_modelbuilder, \�uild()\ unconditionally attempted to decorate \client._user_agent_creator.to_string:
\\python
client = self.sagemaker_session.sagemaker_client
client._user_agent_creator.to_string = self._user_agent_decorator(
self.sagemaker_session.sagemaker_client._user_agent_creator.to_string
)
\
When \LocalSession\ is used (e.g. local container or local mode workflow), \sagemaker_client\ is a \LocalSagemakerClient\ (or custom non-botocore client) which does not have a _user_agent_creator\ attribute. This causes:
\
AttributeError: 'LocalSagemakerClient' object has no attribute '_user_agent_creator'
\\
This PR safely checks for _user_agent_creator\ using \getattr(client, '_user_agent_creator', None). If present (as in standard botocore clients), the user agent decorator is applied as expected; if absent (as in \LocalSagemakerClient), the build proceeds cleanly without error.
Fixes #6603
Tests
Documentation
No documentation changes required.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.