aws / aws/sagemaker-python-sdk

Naming discrepancy between `env` in Processing and `environment` in Estimator

クローズ
#6,214 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
2.3k
フォーク
1.3k
平均マージ
1日 22時間
マージ済み PR(30日)
35

説明

# Describe the feature you'd like
There is a discrepancy on passing environment variables in Processing and Estimator. The parameter is called `env` in Processing and `environment` in Estimator.

I would like these to be aligned. For backwards compatibility sake, this should probably be manifested through a `environment_variables` parameter, but any solution would work for me.

## The problem
The problem is that we cannot have a unified interface to these entities using `**kwargs` to pass arguments without manually parsing a parameter ourselves.

Current situation van be something like this if we use `env` for both situations:

```python
def data_processing(environment: Literal["dev", "preprod", "prod"], **kwargs):
initialize_environment(environment)

return Processing(**kwargs)

def model_training(environment: Literal["dev", "preprod", "prod"], **kwargs):
initialize_environment(environment)

env_vars = kwargs.pop("env")
if env_vars:
kwargs["environment"] = env_vars

return Estimator(**kwargs)

data_processing(environment="dev", env={"MY_VAR": 42})
model_training(environment="dev", env={"MY_VAR": 67})
```

Or with a more compatible interface

```python
def data_processing(environment: Literal["dev", "preprod", "prod"], **kwargs):
initialize_environment(environment)

env_vars = kwargs.pop("environment_variables")
if env_vars:
kwargs["env"] = env_vars

return Processing(**kwargs)

def model_training(environment: Literal["dev", "preprod", "prod"], **kwargs):
initialize_environment(environment)

env_vars = kwargs.pop("environment_variables")
if env_vars:
kwargs["environment"] = env_vars

return Estimator(**kwargs)

data_processing(environment="dev", environment_variables={"MY_VAR": 42})
model_training(environment="dev", environment_variables={"MY_VAR": 67})
```

Ideally, we would want it to look like this because both classes accept a `environment_variables` parameter:

```python
def data_processing(environment: Literal["dev", "preprod", "prod"], **kwargs):
initialize_environment(environment)

return Processing(**kwargs)

def model_training(environment: Literal["dev", "preprod", "prod"], **kwargs):
initialize_environment(environment)

return Estimator(**kwargs)

data_processing(environment="dev", environment_variables={"MY_VAR": 42})
model_training(environment="dev", environment_variables={"MY_VAR": 67})
```

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

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

調査の方向性

まず、Processing と Estimator のエントリーポイントと、それぞれに既存する環境変数パラメーターを特定します。`env` と `environment` がどのように公開されているかを比較し、後方互換性のある共有インターフェースを決定します。既存の使用方法を壊すことなく、両方のエンティティが整合したパラメーターを受け付ければ完了です。

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

評価

技術スタック
aws, python
領域
cloud, machine-learning
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
活発
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

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

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