aws / aws/amazon-sagemaker-examples

[Bug Report] `KeyError` in SgaeMakerPipelines local-mode notebook

Open
#4,468 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
11k
Forks
7k
Avg merge
8h 29m
Merged PRs (30d)
8

Description

**Link to the notebook**
Small bug in [[local-mode-notebook]](https://github.com/aws/amazon-sagemaker-examples/tree/main/sagemaker-pipelines/tabular/local-mode) at
`sagemaker-pipelines/tabular/local-mode/sagemaker-pipelines-local-mode.ipynb`

**Describe the bug**
The the following cell should use index [-2] instead of [-1] for accessing the step outputs returned from local pipeline execution.
```
# Get output of ModelStep
import json

model_name = steps["PipelineExecutionSteps"][-1]["Metadata"]["Model"]["Arn"]
outputs = local_pipeline_session.sagemaker_client.describe_model(ModelName=model_name)
```

**To reproduce**
- Running the cell with [-2] correctly accesses the dict. in reference to the ListSteps response.
- The currently annotated [-1] gives a `KeyError` on "Model" as that references the last step in the list, a transform job, which has a `TransformJob` as it's key, instead of `Model`. For referenece, the generated step output is [[here]](https://paste.amazon.com/show/svia/1698698004)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.