aws / aws/sagemaker-python-sdk

Rich logging still auto-enabled in sagemaker.core

Offen Anfängerfreundlich
#5,561 2 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
2.3k
Forks
1.3k
Ø Merge
1 T. 22 Std.
Gemergte PRs (30 T.)
35

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne bei sagemaker-core/src/sagemaker/core/__init__.py:4 und vergleiche dessen Rich-Setup zur Importzeit mit dem in aws/sagemaker-core#325 beschriebenen Opt-in-Verhalten. Überprüfe, dass das Importieren von sagemaker keine Rich-Tracebacks mehr installiert und den Root-Logger nicht ersetzt und dass die gemeldete Jupyter-Jobausgabe standardmäßig weiterhin unformatiert und scrollbar bleibt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
machine-learning
Issue-Typ
Bug
Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Aktivitätsstatus
Ruhig
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
65/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.