Repository navigation
feature: support capacity_reservation_config in ModelBuilder.deploy #6575
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
9192bb7
86e0357
5d6888b
09417d1
f19ebf4
a202011
0b4b90c
693365f
e9056e8
ffcb9f4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -49,6 +49,7 @@ | |
| instance_supports_kms, | ||
| create_paginator_config, | ||
| validate_path_within_directory, | ||
| _resolve_capacity_reservation_config, | ||
| ) | ||
|
|
||
| from sagemaker.core.config.config_utils import _log_sagemaker_config_merge | ||
|
|
@@ -2940,6 +2941,7 @@ def production_variant( | |
| managed_instance_scaling=None, | ||
| routing_config=None, | ||
| inference_ami_version=None, | ||
| capacity_reservation_config=None, | ||
| ): | ||
| """Create a production variant description suitable for use in a ``ProductionVariant`` list. | ||
|
|
||
|
|
@@ -2973,6 +2975,13 @@ def production_variant( | |
| https://docs.aws.amazon.com/sagemaker/latest/dg/your-algorithms-inference-code.html | ||
| #your-algorithms | ||
| -inference-algo-ping-requests | ||
| capacity_reservation_config (Union[dict, | ||
| sagemaker.core.shapes.ProductionVariantCapacityReservationConfig]): Runs the | ||
| variant's instances on reserved capacity, either a SageMaker training plan | ||
| created for the ``endpoint`` target resource or an ML reservation backed by | ||
| On-Demand Capacity Reservations (ODCRs). A dict must use the | ||
| ``CreateEndpointConfig`` request keys ``CapacityReservationPreference`` and | ||
| ``MlReservationArn``. Ignored for serverless variants (default: None). | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Low: This docstring says |
||
|
|
||
| Returns: | ||
| dict[str, str]: An SageMaker ``ProductionVariant`` description | ||
|
|
@@ -3002,6 +3011,9 @@ def production_variant( | |
| ModelDataDownloadTimeoutInSeconds=model_data_download_timeout, | ||
| ContainerStartupHealthCheckTimeoutInSeconds=container_startup_health_check_timeout, | ||
| RoutingConfig=routing_config, | ||
| CapacityReservationConfig=_resolve_capacity_reservation_config( | ||
| capacity_reservation_config | ||
| ), | ||
| ) | ||
|
|
||
| if inference_ami_version: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing from my live testing for FTP/ODCR change in Sherpa:
CreateEndpointConfigrejects a training-plan ARN unlessCapacityReservationPreferenceiscapacity-reservations-only. The docstring says this, but a caller who passes only the ARN won't find out until the API call fails. Would it make sense to default the preference when the ARN is atraining-plan/ARN, or raise a clear client-side error? botocore doesn't validate the ARN pattern or the enum either, so this would be the first place that catches it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in e9056e8. A
training-plan/ARN without a preference now getsCapacityReservationPreference="capacity-reservations-only"in_resolve_capacity_reservation_config. Every deploy path goes through that function. ML reservation ARNs and explicit preferences are passed as given, and the service still decides whether they're valid. Tests cover the shape and dict inputs, check that the caller's dict isn't mutated, and check the request built bydeploy.