aws / aws/sagemaker-python-sdk

Rich logging still auto-enabled in sagemaker.core

Đang mở Phù hợp với người mới
#5,561 2 bình luận 1 reaction 0 người được giao Xem trên GitHub
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 V3

**Describe the bug**

[sagemaker/core/__init__.py:4](https://github.com/aws/sagemaker-python-sdk/blob/master/sagemaker-core/src/sagemaker/core/__init__.py#L4) unconditionally calls enable_textual_rich_console_and_traceback() at import time, which installs Rich tracebacks (rich.traceback.install) and replaces the root logger with RichHandler the moment sagemaker is imported.

[aws/sagemaker-core#325](https://github.com/aws/sagemaker-core/pull/325) (merged Aug 2025) fixed this in the standalone sagemaker-core package by making Rich opt-in, but that change was never applied to the bundled copy in sagemaker-python-sdk.

To reproduce
```

import sagemaker

# Rich tracebacks are now globally installed
# Rich logging handler is now the root handler
# Any SageMaker job output (processing, training) renders with Rich formatting

from sagemaker.core.helper.session_helper import Session
from sagemaker.core.processing import FrameworkProcessor

sess = Session()

processor = FrameworkProcessor(
image_uri="",
role="",
instance_type="ml.m5.xlarge",
instance_count=1,
)

processor.run(code="script.py", source_dir="source_dir", wait=True)
# Output is non-scrollable Rich-formatted text in Jupyter
```

**Expected behavior**

Rich logging should be opt-in (as intended by [sagemaker-core#325](https://github.com/aws/sagemaker-core/pull/325)), not automatically enabled on import. Job outputs in Jupyter notebooks should be scrollable plain text by default.

**Screenshots or logs**

Image

**System information**
SageMaker Python SDK version: 3.4.1 (sagemaker-core 2.4.1)
Python version: 3.11

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu tại sagemaker-core/src/sagemaker/core/__init__.py:4 và so sánh thiết lập Rich khi import với hành vi opt-in được mô tả trong aws/sagemaker-core#325. Xác minh rằng việc import sagemaker không còn cài đặt traceback của Rich hoặc thay thế root logger, đồng thời đầu ra job Jupyter được báo cáo vẫn ở dạng thuần túy và có thể cuộn theo 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ệ
python
Lĩnh vực
machine-learning
Loại issue
Lỗi
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
65/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.