Repository navigation
fix(core): poll, attach and log transform jobs through the session's region - #6411
Open
AkshayShah03 wants to merge 1 commit into
Open
AkshayShah03 wants to merge 1 commit into
AkshayShah03 wants to merge 1 commit into
Conversation
…region Transformer did not carry its session's region through to the transform job: - transform() built latest_transform_job with TransformJob(**transformed), so wait()/refresh()/stop() used the process-default boto3 session and region rather than the Transformer's sagemaker_session. - attach() passed the SageMaker Session to TransformJob.get(session=...), which expects a boto3 Session, so attach always failed with a pydantic ValidationError. - logs_for_transform_job described the job via TransformJob.get(...).__dict__ (same session type error, default region) and then read PascalCase keys such as TransformResources/TransformJobStatus from that snake_case dict. Bind the job to the session's boto session and region, pass them to TransformJob.get in attach, and describe the job through sagemaker_session.sagemaker_client in logs_for_transform_job, matching the processing-job fix in aws#6369.
AkshayShah03
requested a deployment
to
manual-approval
October 9, 2026 23:59 — with
GitHub Actions
Waiting
AkshayShah03
requested a deployment
to
manual-approval
October 9, 2026 23:59 — with
GitHub Actions
Waiting
AkshayShah03
requested a deployment
to
manual-approval
October 9, 2026 23:59 — 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.
Issue #, if available: N/A (same class of bug as #5796, fixed for processing jobs in #6369)
Description of changes:
Transformerdoesn't carry its session's region through to the transform job:transform()buildslatest_transform_job = TransformJob(**transformed)without a client context.wait(),refresh()andstop()then use the process-default boto3 session and region. With a session in another region, the job is created there but polled in the default region.attach()passes the SageMakerSessiontoTransformJob.get(session=...), which expects a boto3Session, soTransformer.attach(name, sagemaker_session=...)always fails withValidationError: session Input should be an instance of Session.logs_for_transform_jobhas the same problem when describing the job throughTransformJob.get(...).__dict__. It then reads PascalCase keys (TransformResources,TransformJobStatus) from that snake_case dict.This change:
_set_client_context;session=sagemaker_session.boto_session, region=sagemaker_session.boto_region_nametoTransformJob.getinattach;sagemaker_session.sagemaker_client.describe_transform_jobinlogs_for_transform_job, matching fix(processing): respect session region when waiting for processing jobs #6369.The generated
TransformJob.wait(logs=True)builds its CloudWatch log handler without a session, so log streaming there still uses the default region. That's generated code, so I left it alone.Testing:
test_transform_binds_job_to_session_regiontest_attach_uses_boto_session_and_regiontest_logs_for_transform_job_describes_with_session_clienttests/unit/test_transformer.py: 33 passed.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.