aws / aws/sagemaker-python-sdk
Naming discrepancy between `env` in Processing and `environment` in Estimator
- 主要语言
- Python
- 星标
- 2.3k
- 派生
- 1.3k
- 平均合并
- 1 天 22 小时
- 30 天内合并 PR
- 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