Skip to content

fix(core): allow pipeline variables for TransformResources instance_count - #6601

Open
Roxen-AS wants to merge 1 commit into
aws:masterfrom
Roxen-AS:fix/transform-resources-instance-count-pipe-var
Open

Roxen-AS wants to merge 1 commit into
aws:masterfrom
Roxen-AS:fix/transform-resources-instance-count-pipe-var

Conversation

@Roxen-AS

Copy link
Copy Markdown

Summary

Fixes #6577.

In SageMaker Python SDK V3, constructing a pipeline transform step with a parameterized instance_count (e.g. Transformer(..., instance_count=ParameterInteger(...))) failed with a pydantic ValidationError because TransformResources.instance_count was typed strictly as int.

Other resource shapes like ResourceConfig and ProcessingClusterConfig already have PIPE_VAR_OVERRIDES configured for InstanceCount: IntPipeVar.

This change:

  1. Adds TransformResources: {InstanceCount: IntPipeVar} to PIPE_VAR_OVERRIDES in sagemaker-core/src/sagemaker/core/tools/constants.py.
  2. Updates TransformResources.instance_count: IntPipeVar in sagemaker-core/src/sagemaker/core/shapes/shapes.py.
  3. Adds TransformResources.instance_count to the codegen test cases in sagemaker-core/tests/unit/tools/test_shapes_extractor.py.
  4. Adds a regression unit test in sagemaker-core/tests/unit/test_transformer.py validating that TransformResources and Transformer accept ParameterInteger for instance_count.

Testing

  • Unit tests run via pytest:
    • sagemaker-core/tests/unit/tools/test_shapes_extractor.py (29 passed)
    • sagemaker-core/tests/unit/test_transformer.py (31 passed, including new test_instance_count_accepts_pipeline_variable)
  • Code formatting and style clean across all modified files.

Add TransformResources to PIPE_VAR_OVERRIDES for InstanceCount so that TransformResources.instance_count accepts IntPipeVar (e.g. ParameterInteger), allowing parameterized instance counts when constructing transform steps in pipelines. Fixes aws#6577.

Signed-off-by: Roxen-AS <akash.arjun12@gmail.com>

This branch is waiting to be deployed

1 waiting deployment
manual-approval — bf1ab619 Waiting Nov 24, 2026 by Roxen-AS via wait-for-approval #2276
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TransformResources.instance_count rejects ParameterInteger, breaking parameterized instance counts in V3 Pipelines

1 participant