Repository navigation
fix(serve): call create_endpoint_config with production variants on update_endpoint - #6402
AkshayShah03 wants to merge 2 commits into
Conversation
…pdate_endpoint ModelBuilder.deploy(update_endpoint=True) called Session.create_endpoint_config with per-variant kwargs (model_name, instance_type, ...) that the core Session does not accept, so every endpoint update failed with a TypeError. Pass the production variant that is already built for the deploy, give the new endpoint config a unique name (the model name is reused across updates), and forward wait to update_endpoint. Fixes aws#5609
There was a problem hiding this comment.
🤖 AI code review
This PR fixes ModelBuilder.deploy(update_endpoint=True) on the core Session by passing the already-built production_variant to Session.create_endpoint_config rather than per-variant kwargs that the core signature no longer accepts. I verified against sagemaker-core/src/sagemaker/core/helper/session_helper.py: the new kwargs (name, production_variants, tags, kms_key, data_capture_config_dict, async_inference_config_dict, explainer_config_dict) match create_endpoint_config's signature, update_endpoint accepts wait, and serverless/routing/AMI settings now reach the config via the production variant. The change is correct, matches the create path's behavior, and is covered by a targeted unit test. No issues found.
Reviewed commit 74e2599. Automated review; verify before acting.
Issue #, if available: Fixes #5609
Description of changes:
With the core
Session,ModelBuilder.deploy(update_endpoint=True)cannot work._deploy_core_endpointcallsSession.create_endpoint_configwith per-variant kwargs (model_name,initial_instance_count,instance_type,volume_size, ...). Sincecreate_endpoint_configwas added to the coreSession, the call raisesTypeErrorinstead of theAttributeErrorin the issue: the method takes(name, production_variants, tags, kms_key, data_capture_config_dict, async_inference_config_dict, explainer_config_dict, ...).This change:
production_variantthat_deploy_core_endpointalready builds a few lines earlier, so instance type and count, volume size, timeouts, serverless config, routing config and AMI version all reach the new config as they do on the create path;unique_name_from_base(self.model_name). Endpoint config names can't be reused, and the model name stays the same across updates;waittoupdate_endpoint. It previously always waited.Testing:
test_deploy_core_endpoint_update_endpoint_creates_config_from_variants: binds the actual call kwargs against the realSession.create_endpoint_configsignature, then checks the production variant, the unique config name, andupdate_endpoint(..., wait=False). It fails before this change.sagemaker-serve/tests/unitrun: no new failures compared with master. The same 70 tests fail on master and on this branch; they need AWS credentials or depend on test order.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.