aws / aws/sagemaker-python-sdk

Rich logging still auto-enabled in sagemaker.core

オープン 初心者向け
#5,561 コメント 2 件 リアクション 1 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
2.3k
フォーク
1.3k
平均マージ
1日 22時間
マージ済み PR(30日)
35

説明

**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

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

sagemaker-core/src/sagemaker/core/__init__.py:4 から始め、インポート時の Rich セットアップを aws/sagemaker-core#325 で説明されている opt-in 動作と比較します。sagemaker をインポートしても Rich の traceback がインストールされず、root logger が置き換えられないこと、また報告されている Jupyter ジョブの出力がデフォルトで引き続きプレーンでスクロール可能であることを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
machine-learning
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
静か
明瞭さ
明確に書かれている
初心者へのやさしさ
65/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。