Repository navigation
Commit 26ee8ff
committed
fix(core): Thread the resource session through object methods
The previous commit made SageMakerClient honor an explicit session, but
the generated object methods still ignored it: refresh(), update(),
delete() and stop() called Base.get_sagemaker_client() (or a bare
SageMakerClient()) with no session and fell back to the process default
client. With a default-chain client built first,
ModelTrainer.train(wait=True) created the job in the caller's account
and then polled it in another one (#6069).
Base now carries private _session/_region attributes. get() (and so
create(), load(), and the get_all() iterator for each listed resource)
binds them; refresh/update/delete/stop and every generated object method
build their client from them, with explicit session/region arguments
still taking precedence. Resources constructed directly keep the old
process-default behaviour.
Changes are made in the codegen templates and resources.py is
regenerated from them; only the client-context hunks are kept, the
unrelated service-model docstring drift from regeneration is dropped.
Related: #6069
---
X-AI-Prompt: Fix the generated refresh/wait/stop methods to use the resource's session (PR 6273 review)
X-AI-Tool: Kiro1 parent cd7fd9c commit 26ee8ff
5 files changed
Lines changed: 702 additions & 352 deletions
File tree
- sagemaker-core
- src/sagemaker/core
- tools
- utils
- tests/unit
0 commit comments