Fix/aml 509849 - #6120
Conversation
… singleton pinning
Remove the temporary SAGEMAKER_ENDPOINT / SAGEMAKER_RUNTIME_ENDPOINT /
SAGEMAKER_STAGE overrides and the custom botocore service-model loader from
SageMakerClient. These were internal beta/gamma testing shims (marked
"# TODO: Remove post-launch") added while the generic Job APIs were not yet in
public botocore. Those APIs (CreateJob/DescribeJob/ListJobs) now ship in public
botocore, so the standard session.client("sagemaker", ...) path is used and the
env-driven endpoint redirection is no longer read by the SDK.
Also fix SingletonMeta so SageMakerClient is keyed by (session, region) instead
of by class alone. Previously the first instance was pinned process-wide, so a
later call with a different session/region silently reused the original client.
Parameterless SageMakerClient() calls still share a single instance.
Harden the container-driver env logger to mask values that look like AWS
credential material (access key IDs, session tokens) even when the key name
contains none of SENSITIVE_KEYWORDS.
…logging The startup env logger masked only by key name, so a sensitive value under a key name without a SENSITIVE_KEYWORDS substring was logged verbatim. Add value-based detection for AWS credential material (access key IDs, session tokens) so such values are masked regardless of key name.
|
Claude finished @lucasjia-aws's task in 2m 51s —— View job Claude review — Fix/aml 509849
I reviewed the four changed files. The change splits into two independent concerns: (1) masking credential-shaped values in container env logging, and (2) reworking
🟠
|
Make SageMakerClient._singleton_key tolerant of extra constructor arguments by accepting *args/**kwargs, so callers passing additional keywords (such as the legacy service_name=) no longer raise a TypeError during key computation on cache-hit paths. Document why id(session) is a stable cache key: the cached instance retains the session reference, preventing garbage collection and id reuse while the entry lives. Add unit tests for the singleton keying and reset(): distinct instance per (session, region), reuse across repeated no-arg calls, reuse for an identical session/region, and reset() clearing all keyed entries for the class. Rework the env-logging test assertion to compare the logged arguments exactly instead of a URL substring check, removing the CodeQL incomplete-URL-sanitization finding on the test file.
|
Claude finished @lucasjia-aws's task in 1m 31s —— View job Claude review — Fix/aml 509849 (re-review after sync)
Thanks for the updates — the two items I flagged as most important last round are resolved:
🟢 CodeQL alert (
|
Issue #, if available:
Description of changes:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.