

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 建立和執行功能儲存功能處理器管線
<a name="feature-store-feature-processor-create-execute-pipeline"></a>

特徵處理器 SDK 提供 API，可將您的特徵處理器定義提升為完全受控的 SageMaker AI 管道。如需 Pipelines 的詳細資訊，請參閱 [管道概觀](pipelines-overview.md)。若要將特徵處理器定義轉換為 SageMaker AI 管道，請使用 `to_pipeline` API 搭配您的特徵處理器定義。您可以排程功能處理器定義的執行，並使用 CloudWatch 指標進行操作監控，並將它們與 EventBridge 整合以充當事件來源或訂閱者。如需監控使用 Pipelines 建立的管道的詳細資訊，請參閱[監控 Amazon SageMaker Feature Store 特徵處理器管道](feature-store-feature-processor-monitor-pipeline.md)。

若要檢視特徵處理器管道，請參閱[從主控台檢視管道執行](feature-store-use-with-studio.md#feature-store-view-feature-processor-pipeline-executions-studio)。

如果您的函式也使用 `@remote` 裝飾器進行裝飾，則其組態將轉移到特徵處理器管道。您可以使用 `@remote` 裝飾器指定進階組態，例如運算執行個體類型和計數、執行期相依性、網路和安全組態。

以下範例使用了 `to_pipeline` 和 `execute` API。

```
from sagemaker.feature_store.feature_processor import (
    execute, to_pipeline, describe, TransformationCode
)

pipeline_name="feature-processor-pipeline"
pipeline_arn = to_pipeline(
    pipeline_name=pipeline_name,
    step=transform,
    transformation_code=TransformationCode(s3_uri="s3://bucket/prefix"),
)

pipeline_execution_arn = execute(
    pipeline_name=pipeline_name
)
```

`to_pipeline` API 在語意上是更新插入作業。如果管道已存在，則更新管道；如果不存在管道，則建立管道。

`to_pipeline` API 可選擇接受 Amazon S3 URI，該 URI 參考包含特徵處理器定義的檔案，以將其與特徵處理器管道建立關聯，從而追蹤轉換函式及其 SageMaker AI 機器學習歷程中的版本。

若要擷取您的帳戶中每個特徵處理器管道的清單，您可以透過 `list_pipelines` API。對 `describe` API 的後續請求會傳回與特徵處理器管道相關的詳細資訊，包含但不限於 Pipelines 和排程詳細資訊。

以下範例使用了 `list_pipelines` 和 `describe` API。

```
from sagemaker.feature_store.feature_processor import list_pipelines, describe

feature_processor_pipelines = list_pipelines()

pipeline_description = describe(
    pipeline_name = feature_processor_pipelines[0]
)
```