aws / aws/sagemaker-python-sdk
ModelBuilder.deploy(update_endpoint=True) raises AttributeError on Session.create_endpoint_config()
- Ngôn ngữ chính
- Python
- Star
- 2.3k
- Fork
- 1.3k
- Merge trung bình
- 1 ngày 22 giờ
- Pull request đã merge (30 ngày)
- 35
Mô tả
**PySDK Version**
- [ ] PySDK V2 (2.x)
- [x] PySDK V3 (3.x)
**Describe the bug**
`ModelBuilder.deploy(update_endpoint=True)` raises `AttributeError: 'Session' object has no attribute 'create_endpoint_config'`.
In the installed V3 packages, `ModelBuilder._deploy_core_endpoint()` calls `self.sagemaker_session.create_endpoint_config(...)` on the update path, but `sagemaker.core.helper.session_helper.Session` does not implement that method.
**To reproduce**
Run the following script:
```python
from types import SimpleNamespace
import boto3
from sagemaker.core.helper.session_helper import Session
from sagemaker.serve.model_builder import ModelBuilder
builder = ModelBuilder(
s3_model_data_url={
"S3DataSource": {
"S3Uri": "s3://example-bucket/model/",
"S3DataType": "S3Prefix",
"CompressionType": "None",
}
},
image_uri="123456789012.dkr.ecr.us-west-2.amazonaws.com/example:latest",
role_arn="arn:aws:iam::123456789012:role/SageMakerExecutionRole",
sagemaker_session=Session(boto_session=boto3.Session(region_name="us-west-2")),
instance_type="ml.g5.xlarge",
env_vars={},
)
builder.model_name = "demo-model"
builder.region = "us-west-2"
builder.endpoint_name = "demo-endpoint"
builder.built_model = SimpleNamespace(model_name="demo-model")
builder._deploy_core_endpoint(
endpoint_name="demo-endpoint",
instance_type="ml.g5.xlarge",
initial_instance_count=1,
wait=False,
update_endpoint=True,
)
```
**Steps**
1. Create a Python environment with the V3 SageMaker packages listed below.
2. Save the script above.
3. Run `python minimal_repro_model_builder_update_endpoint.py`.
**Expected behavior**
One of the following should happen:
- `ModelBuilder.deploy(update_endpoint=True)` should work with the default `Session` implementation used by V3 packages.
- Or `ModelBuilder` should use a session method that actually exists on `sagemaker.core.helper.session_helper.Session`.
**Screenshots or logs**
Actual error:
```text
AttributeError: 'Session' object has no attribute 'create_endpoint_config'
```
I also confirmed locally that:
- `hasattr(Session, "create_endpoint_config") == False`
- `ModelBuilder._deploy_core_endpoint()` contains a call to `self.sagemaker_session.create_endpoint_config(...)`
In my real deployment code, this was triggered from `ModelBuilder.build(...); ModelBuilder.deploy(..., update_endpoint=True)` while updating an existing SageMaker endpoint.
**System information**
- **SageMaker Python SDK version**: V3 packages; `sagemaker-core==2.5.0`, `sagemaker-serve==1.5.0`
- **Framework name (eg. PyTorch) or algorithm (eg. KMeans)**: N/A for repro; issue is in `ModelBuilder` update flow
- **Framework version**: N/A
- **Python version**: 3.14.3
- **CPU or GPU**: Repro itself is local and does not require either; production usage was GPU-backed SageMaker endpoint deployment
- **Custom Docker image (Y/N)**: N
**Additional context**
- Avoiding `update_endpoint=True` and recreating the endpoint instead works around the issue.
- This looks related to the ongoing V3 API/session transition, and may be adjacent to issue #5336, but this report is specifically about the missing `create_endpoint_config()` method on the session object used by `ModelBuilder`.
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện lỗi với script tối thiểu, sau đó kiểm tra ModelBuilder._deploy_core_endpoint và sagemaker.core.helper.session_helper.Session, tập trung vào đường dẫn update_endpoint và lệnh gọi create_endpoint_config còn thiếu. Xác nhận bản sửa bằng cách chạy lại reproduction và xác minh rằng việc cập nhật một endpoint hiện có hoạt động với triển khai V3 Session mặc định.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- aws, python
- Lĩnh vực
- cloud, machine-learning
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 58/100