

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 最佳实践
<a name="pipelines-step-decorator-best"></a>

以下各节建议了在管道步骤中使用 `@step` 装饰器时应遵循的最佳实践。

## 使用暖池
<a name="pipelines-step-decorator-best-warmpool"></a>

要加快管道步骤运行速度，可使用为训练作业提供的热池功能。您可以通过为 `@step` 装饰器提供 `keep_alive_period_in_seconds` 参数来开启暖池功能，如以下代码段所示：

```
@step(
   keep_alive_period_in_seconds=900
)
```

有关暖池的更多信息，请参阅 [SageMaker AI 管理的暖池](train-warm-pools.md)。

## 目录结构
<a name="pipelines-step-decorator-best-dir"></a>

建议您在使用 `@step` 装饰器时使用代码模块。将调用步骤函数和定义管道的 `pipeline.py` 模块放在工作区的根部。建议的结构如下：

```
.
├── config.yaml # the configuration file that define the infra settings
├── requirements.txt # dependencies
├── pipeline.py  # invoke @step-decorated functions and define the pipeline here
├── steps/
| ├── processing.py
| ├── train.py
├── data/
├── test/
```