

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# ステップキャッシュを無効にする
<a name="pipelines-caching-disabling"></a>

ステップタイプの [パイプラインステップタイプ別のデフォルトのキャッシュキー属性](pipelines-default-keys.md) にリストされていない属性を変更しても、パイプラインステップは再実行されません。ただし、それでもパイプラインステップを再実行したいこともあります。その場合は、ステップキャッシュを無効にする必要があります。

ステップキャッシュを無効にするには、次のコードスニペットに示すように、ステップ定義内のステップ定義の `CacheConfig` プロパティの `Enabled` 属性を `false` に設定します。

```
{
    "CacheConfig": {
        "Enabled": false,
        "ExpireAfter": "<time>"
    }
}
```

`Enabled` が `false` に設定されている場合、`ExpireAfter` 属性は無視されることに注意してください。

Amazon SageMaker Python SDK を使用してパイプラインステップのキャッシュを無効にするには、パイプラインステップのパイプラインを定義し、`enable_caching` プロパティをオフにしてパイプラインを更新します。

これを再実行すると、次のコードサンプルがトレーニングステップのキャッシュを無効にします。

```
from sagemaker.workflow.pipeline_context import PipelineSession
from sagemaker.workflow.steps import CacheConfig
from sagemaker.workflow.pipeline import Pipeline

cache_config = CacheConfig(enable_caching=False, expire_after="PT1H")
estimator = Estimator(..., sagemaker_session=PipelineSession())

step_train = TrainingStep(
    name="TrainAbaloneModel",
    step_args=estimator.fit(inputs=inputs),
    cache_config=cache_config
)

# define pipeline
pipeline = Pipeline(
    steps=[step_train]
)

# update the pipeline
pipeline.update()
# or, call upsert() to update the pipeline
# pipeline.upsert()
```

または、パイプラインを定義した後で `enable_caching` プロパティを無効にして、コードを 1 回連続して実行できるようにします。以下のコードサンプルはこのソリューションを示しています。

```
# turn off caching for the training step
pipeline.steps[0].cache_config.enable_caching = False

# update the pipeline
pipeline.update()
# or, call upsert() to update the pipeline
# pipeline.upsert()
```

詳細なコードサンプルと Python SDK パラメータがキャッシュに及ぼす影響に関する説明については、Amazon SageMaker Python SDK ドキュメントの「[Caching Configuration](https://sagemaker.readthedocs.io/en/stable/amazon_sagemaker_model_building_pipeline.html#caching-configuration)」を参照してください。