aws / aws/sagemaker-python-sdk

Library logs to stdout on import

未关闭
#4,387 1 条评论 2 个 reaction 已指派 1 人 已被 @nargokul 认领 在 GitHub 查看
component: debugger component: pysdk-team type: bug
主要语言
Python
星标
2.3k
派生
1.3k
平均合并
1 天 22 小时
30 天内合并 PR
35

描述

**Describe the bug**

Logging to stdout is an undesirable default for a library, especially since tools that use the library will want to control what is written to stdout. For example, imagine a command line program that fetches records from FeatureStore or metadata about training runs and writes the data to stdout so that it can be parsed by other tools like `grep` or `jq` or `awk`.

This is most likely caused by [this line](https://github.com/aws/sagemaker-python-sdk/blob/f60dd3b3710a30f56a19552c1d59a063802a4e62/src/sagemaker/config/config_utils.py#L42).

**To reproduce**

```
import sagemaker
```
This writes to `stdout`:
```
>>> import sagemaker
sagemaker.config INFO - Not applying SDK defaults from location: /etc/xdg/sagemaker/config.yaml
sagemaker.config INFO - Not applying SDK defaults from location: /home/username/.config/sagemaker/config.yaml
```

**Expected behavior**
I would expect this to be written to `stderr` so that it doesn't interfere with regular program output.

**Screenshots or logs**
If applicable, add screenshots or logs to help explain your problem.

**System information**
A description of your system. Please provide:
- **SageMaker Python SDK version**: `'2.198.0'`
- **Framework name (eg. PyTorch) or algorithm (eg. KMeans)**: N/A
- **Framework version**: N/A
- **Python version**: `3.8`
- **CPU or GPU**: `Intel(R) Xeon(R) CPU E5-2686 v4 @ 2.30GHz`
- **Custom Docker image (Y/N)**: N

**Additional context**
Add any other context about the problem here.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。