Repository navigation
Commit a5b30c4
refactor: Remove Bedrock step types and clean up step test modules (#6223)
* refactor: Remove Bedrock step types and clean up step test modules
Removes the four Bedrock pipeline step classes (BedrockCustomModelStep,
BedrockCustomModelDeploymentStep, BedrockModelImportStep,
BedrockProvisionedModelThroughputStep) and their StepTypeEnum values
pending re-evaluation of SDK support for these step types. They can be
reintroduced later if needed. The remaining step types
(EndpointConfigStep, EndpointStep, InferenceComponentStep, LineageStep)
are unchanged.
Also renames the step test modules to descriptive names
(test_inference_lineage_steps.py, test_lineage_step.py) and removes the
now-unused camelCase-to-PascalCase member-name conversion from the
argument validation helper (it existed only for the Bedrock APIs).
---
X-AI-Prompt: Follow-up on the merged v2 backport: remove Bedrock step
types and internal-codename file names
X-AI-Tool: kiro-cli
* refactor(pipeline): Align inference and lineage steps with v3
Brings the four step types from #6153 onto the same design as v3, so both
majors present one API. These steps are not in use yet, so the change is
made directly rather than with a deprecation path.
Steps now take step_args captured under a PipelineSession instead of a raw
arguments dict, following the convention used by TrainingStep and
ModelStep. Capture goes through one seam:
PipelineSession._intercept_create_request returns the captured context, so
a producer returns its result directly.
Producers, all now routed through that seam:
- Session.create_endpoint_config, which creates only the endpoint
configuration. It gained an optional production_variants argument,
appended last so existing callers are unaffected, because an
inference-component endpoint needs a variant with no model name that the
single-model form cannot express.
- Session.create_endpoint and Session.create_inference_component.
- Action.create(), Artifact.create() and Context.create() for lineage,
whose requests Record._invoke_api now routes through the same seam.
LineageStep takes actions, artifacts, contexts and associations. A step
creates a batch of entities and its associations reference them by name and
type, or by ARN for an entity created elsewhere. This replaces the
cross-step Steps.<Name>.ActionArns['<name>'] form, which could not
resolve: the service matches an association endpoint against the entities
created by the same step, so a reference to another step's entity fails
the execution.
Two fixes fall out of the seam change:
PipelineModel.register() tested the intercept result with
`"ModelPackageArn" in model_package`, which raises TypeError once that
result is a step arguments object rather than None. It now checks for a
dict first.
The lineage unit tests used a bare Mock session, whose auto-mocked
_intercept_create_request swallowed the request so the client was never
called. The double now invokes the callable, as the real base Session
does.
_argument_validation.py is deleted. With the Bedrock steps removed by the
previous commit and the four remaining steps on step_args, nothing uses
it.
Testing: 39 unit tests for the four steps. The lineage, step, pipeline,
pipeline session and pipeline model suites were run against the previous
commit and this one with identical results. The integration tests are
ported but were not run against the service on this branch; the equivalent
v3 tests pass end to end.
---
X-AI-Prompt: Re-port v2 onto the new design
X-AI-Tool: kiro-cli
* fix(pipeline): Let create_endpoint_config build an IC endpoint config
Found by running the deployment integration test against SageMaker.
An inference-component endpoint config carries a production variant with no
model name, and therefore needs ExecutionRoleArn in place of a model.
create_endpoint_config had no way to supply it, so the test failed with
"unexpected keyword argument 'role'". A role argument is added, appended
last so existing callers are unaffected, applying the same rule
endpoint_from_production_variants already uses: when no variant names a
model, expand the role and set ExecutionRoleArn.
The KMS check then failed too, because instance_supports_kms() was called
with the instance_type that explicit variants leave as None. It now derives
KMS support from the variants in that case, as v3 does, and keeps using
instance_type when one is given.
Also moves the deployment test's resource creation inside its try, so a
failure between creating the model and starting the pipeline still reaches
cleanup. The two failures above leaked a model and an S3 object each,
because both were created before the try began.
Testing: both integration tests now pass against SageMaker -- lineage in
11.70s and the chained EndpointConfig -> Endpoint -> InferenceComponent
pipeline in 396.23s, with the endpoint and component observed InService and
no resources left behind. The 25 existing create_endpoint_config and
endpoint_from_production_variants unit tests still pass, confirming the
single-model path is unchanged.
---
X-AI-Prompt: Run the v2 integ tests against the service, also make sure you
are removing the old code and adding the new code
X-AI-Tool: kiro-cli
* fix(tests): Use the shared session fixtures in the new integ tests
Both new integ tests defined local sagemaker_session and pipeline_session
fixtures returning a bare Session() / PipelineSession(), shadowing the
shared ones. CI runs the integ suite with AWS_DEFAULT_REGION unset, so a
bare session has no region and both tests errored at setup with "Must setup
local AWS configuration with a region supported by SageMaker". Reported by
@jam-jee on the PR.
The local role fixture went too: the workflow conftest already provides one.
The shared fixtures build on a boto3.Session carrying an explicit region,
which is exactly what was missing.
My earlier runs passed only because the harness exported
AWS_DEFAULT_REGION, which hid this. Both tests have now been re-run with
that variable unset, matching CI: lineage in 11.83s and the chained
EndpointConfig -> Endpoint -> InferenceComponent pipeline in 411.04s, with
no resources left behind.
---
X-AI-Prompt: did you read the comment on the pr?
X-AI-Tool: kiro-cli
---------
Co-authored-by: Rishabh Devnani <rdevnani@amazon.com>1 parent 88dbcc2 commit a5b30c4
17 files changed
Lines changed: 1582 additions & 1230 deletions
File tree
- src/sagemaker
- apiutils
- workflow
- tests
- integ/sagemaker/workflow
- unit/sagemaker
- lineage
- workflow
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
222 | 231 | | |
223 | 232 | | |
224 | 233 | | |
225 | 234 | | |
226 | | - | |
227 | | - | |
228 | | - | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
485 | 485 | | |
486 | 486 | | |
487 | 487 | | |
488 | | - | |
| 488 | + | |
489 | 489 | | |
490 | 490 | | |
491 | 491 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4857 | 4857 | | |
4858 | 4858 | | |
4859 | 4859 | | |
4860 | | - | |
4861 | | - | |
4862 | | - | |
| 4860 | + | |
| 4861 | + | |
| 4862 | + | |
4863 | 4863 | | |
4864 | 4864 | | |
4865 | 4865 | | |
| |||
4872 | 4872 | | |
4873 | 4873 | | |
4874 | 4874 | | |
| 4875 | + | |
| 4876 | + | |
4875 | 4877 | | |
4876 | 4878 | | |
4877 | 4879 | | |
| |||
4933 | 4935 | | |
4934 | 4936 | | |
4935 | 4937 | | |
| 4938 | + | |
| 4939 | + | |
| 4940 | + | |
| 4941 | + | |
| 4942 | + | |
| 4943 | + | |
| 4944 | + | |
| 4945 | + | |
| 4946 | + | |
| 4947 | + | |
4936 | 4948 | | |
4937 | 4949 | | |
4938 | 4950 | | |
| |||
4942 | 4954 | | |
4943 | 4955 | | |
4944 | 4956 | | |
4945 | | - | |
| 4957 | + | |
| 4958 | + | |
| 4959 | + | |
4946 | 4960 | | |
4947 | | - | |
4948 | | - | |
4949 | 4961 | | |
4950 | | - | |
4951 | | - | |
4952 | | - | |
4953 | | - | |
4954 | | - | |
4955 | | - | |
4956 | | - | |
4957 | | - | |
4958 | | - | |
4959 | | - | |
4960 | | - | |
4961 | | - | |
4962 | | - | |
| 4962 | + | |
| 4963 | + | |
| 4964 | + | |
| 4965 | + | |
| 4966 | + | |
| 4967 | + | |
| 4968 | + | |
| 4969 | + | |
| 4970 | + | |
| 4971 | + | |
| 4972 | + | |
| 4973 | + | |
| 4974 | + | |
| 4975 | + | |
4963 | 4976 | | |
4964 | 4977 | | |
4965 | 4978 | | |
| |||
4975 | 4988 | | |
4976 | 4989 | | |
4977 | 4990 | | |
| 4991 | + | |
| 4992 | + | |
| 4993 | + | |
| 4994 | + | |
| 4995 | + | |
| 4996 | + | |
| 4997 | + | |
| 4998 | + | |
| 4999 | + | |
| 5000 | + | |
| 5001 | + | |
| 5002 | + | |
| 5003 | + | |
| 5004 | + | |
| 5005 | + | |
4978 | 5006 | | |
4979 | 5007 | | |
4980 | 5008 | | |
4981 | 5009 | | |
4982 | 5010 | | |
4983 | 5011 | | |
| 5012 | + | |
| 5013 | + | |
| 5014 | + | |
| 5015 | + | |
| 5016 | + | |
| 5017 | + | |
| 5018 | + | |
| 5019 | + | |
| 5020 | + | |
| 5021 | + | |
| 5022 | + | |
4984 | 5023 | | |
4985 | 5024 | | |
4986 | 5025 | | |
4987 | 5026 | | |
4988 | | - | |
| 5027 | + | |
4989 | 5028 | | |
4990 | 5029 | | |
4991 | 5030 | | |
| |||
5008 | 5047 | | |
5009 | 5048 | | |
5010 | 5049 | | |
5011 | | - | |
5012 | | - | |
| 5050 | + | |
| 5051 | + | |
| 5052 | + | |
| 5053 | + | |
| 5054 | + | |
| 5055 | + | |
| 5056 | + | |
| 5057 | + | |
5013 | 5058 | | |
5014 | 5059 | | |
5015 | 5060 | | |
| |||
5169 | 5214 | | |
5170 | 5215 | | |
5171 | 5216 | | |
5172 | | - | |
| 5217 | + | |
| 5218 | + | |
| 5219 | + | |
5173 | 5220 | | |
5174 | 5221 | | |
5175 | 5222 | | |
5176 | 5223 | | |
5177 | 5224 | | |
5178 | | - | |
5179 | | - | |
5180 | 5225 | | |
5181 | 5226 | | |
5182 | 5227 | | |
5183 | 5228 | | |
5184 | 5229 | | |
5185 | | - | |
5186 | | - | |
5187 | | - | |
5188 | | - | |
| 5230 | + | |
| 5231 | + | |
| 5232 | + | |
| 5233 | + | |
| 5234 | + | |
| 5235 | + | |
| 5236 | + | |
| 5237 | + | |
| 5238 | + | |
5189 | 5239 | | |
5190 | 5240 | | |
5191 | 5241 | | |
5192 | 5242 | | |
5193 | 5243 | | |
5194 | 5244 | | |
| 5245 | + | |
| 5246 | + | |
| 5247 | + | |
| 5248 | + | |
| 5249 | + | |
5195 | 5250 | | |
5196 | 5251 | | |
5197 | 5252 | | |
| |||
5361 | 5416 | | |
5362 | 5417 | | |
5363 | 5418 | | |
| 5419 | + | |
| 5420 | + | |
5364 | 5421 | | |
5365 | | - | |
5366 | | - | |
5367 | | - | |
5368 | | - | |
5369 | | - | |
5370 | | - | |
5371 | 5422 | | |
5372 | 5423 | | |
5373 | 5424 | | |
| |||
5387 | 5438 | | |
5388 | 5439 | | |
5389 | 5440 | | |
5390 | | - | |
5391 | | - | |
5392 | | - | |
5393 | | - | |
| 5441 | + | |
| 5442 | + | |
| 5443 | + | |
| 5444 | + | |
| 5445 | + | |
| 5446 | + | |
| 5447 | + | |
| 5448 | + | |
| 5449 | + | |
| 5450 | + | |
| 5451 | + | |
| 5452 | + | |
| 5453 | + | |
| 5454 | + | |
5394 | 5455 | | |
5395 | 5456 | | |
5396 | 5457 | | |
| |||
0 commit comments