Notebooks
A
Amazon Web Services
Sm Pipelines Selective Execution

Sm Pipelines Selective Execution

data-scienceinferenceamazon-sagemaker-examplesreinforcement-learningml_opsmachine-learningawsexamplesdeep-learningsagemakerjupyter-notebooktrainingsm-pipelines_selective_executionmlops

SageMaker Pipelines: Selective Execution Demo


This notebook's CI test result for us-west-2 is as follows. CI test results in other regions can be found at the end of the notebook.

This us-west-2 badge failed to load. Check your device's internet connectivity, otherwise the service is currently unavailable


In this demo notebook, we will walk a user through, 1/ Setting up a new SageMaker pipeline which consists of Pre-Processing, Training, Evaluation and Model Registration - aka end-2-end ML Pipeline 2/ How to leverage the previously defined end-2-end pipeline for Selective Execution - to selectively run subsets of your pipeline

The flow of this notebook is as follows,

[2]
Requirement already satisfied: sagemaker==2.162.0 in /opt/conda/lib/python3.10/site-packages (2.162.0)
Requirement already satisfied: attrs<24,>=23.1.0 in /opt/conda/lib/python3.10/site-packages (from sagemaker==2.162.0) (23.1.0)
Requirement already satisfied: boto3<2.0,>=1.26.131 in /opt/conda/lib/python3.10/site-packages (from sagemaker==2.162.0) (1.26.153)
Requirement already satisfied: cloudpickle==2.2.1 in /opt/conda/lib/python3.10/site-packages (from sagemaker==2.162.0) (2.2.1)
Requirement already satisfied: google-pasta in /opt/conda/lib/python3.10/site-packages (from sagemaker==2.162.0) (0.2.0)
Requirement already satisfied: numpy<2.0,>=1.9.0 in /opt/conda/lib/python3.10/site-packages (from sagemaker==2.162.0) (1.24.3)
Requirement already satisfied: protobuf<4.0,>=3.1 in /opt/conda/lib/python3.10/site-packages (from sagemaker==2.162.0) (3.20.3)
Requirement already satisfied: protobuf3-to-dict<1.0,>=0.1.5 in /opt/conda/lib/python3.10/site-packages (from sagemaker==2.162.0) (0.1.5)
Requirement already satisfied: smdebug-rulesconfig==1.0.1 in /opt/conda/lib/python3.10/site-packages (from sagemaker==2.162.0) (1.0.1)
Requirement already satisfied: importlib-metadata<5.0,>=1.4.0 in /opt/conda/lib/python3.10/site-packages (from sagemaker==2.162.0) (4.11.3)
Requirement already satisfied: packaging>=20.0 in /opt/conda/lib/python3.10/site-packages (from sagemaker==2.162.0) (21.3)
Requirement already satisfied: pandas in /opt/conda/lib/python3.10/site-packages (from sagemaker==2.162.0) (1.4.4)
Requirement already satisfied: pathos in /opt/conda/lib/python3.10/site-packages (from sagemaker==2.162.0) (0.3.0)
Requirement already satisfied: schema in /opt/conda/lib/python3.10/site-packages (from sagemaker==2.162.0) (0.7.5)
Requirement already satisfied: PyYAML==6.0 in /opt/conda/lib/python3.10/site-packages (from sagemaker==2.162.0) (6.0)
Requirement already satisfied: jsonschema in /opt/conda/lib/python3.10/site-packages (from sagemaker==2.162.0) (3.2.0)
Requirement already satisfied: platformdirs in /opt/conda/lib/python3.10/site-packages (from sagemaker==2.162.0) (2.5.2)
Requirement already satisfied: tblib==1.7.0 in /opt/conda/lib/python3.10/site-packages (from sagemaker==2.162.0) (1.7.0)
Requirement already satisfied: botocore<1.30.0,>=1.29.153 in /opt/conda/lib/python3.10/site-packages (from boto3<2.0,>=1.26.131->sagemaker==2.162.0) (1.29.153)
Requirement already satisfied: jmespath<2.0.0,>=0.7.1 in /opt/conda/lib/python3.10/site-packages (from boto3<2.0,>=1.26.131->sagemaker==2.162.0) (0.10.0)
Requirement already satisfied: s3transfer<0.7.0,>=0.6.0 in /opt/conda/lib/python3.10/site-packages (from boto3<2.0,>=1.26.131->sagemaker==2.162.0) (0.6.0)
Requirement already satisfied: zipp>=0.5 in /opt/conda/lib/python3.10/site-packages (from importlib-metadata<5.0,>=1.4.0->sagemaker==2.162.0) (3.8.0)
Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in /opt/conda/lib/python3.10/site-packages (from packaging>=20.0->sagemaker==2.162.0) (3.0.9)
Requirement already satisfied: six in /opt/conda/lib/python3.10/site-packages (from protobuf3-to-dict<1.0,>=0.1.5->sagemaker==2.162.0) (1.16.0)
Requirement already satisfied: pyrsistent>=0.14.0 in /opt/conda/lib/python3.10/site-packages (from jsonschema->sagemaker==2.162.0) (0.18.0)
Requirement already satisfied: setuptools in /opt/conda/lib/python3.10/site-packages (from jsonschema->sagemaker==2.162.0) (67.8.0)
Requirement already satisfied: python-dateutil>=2.8.1 in /opt/conda/lib/python3.10/site-packages (from pandas->sagemaker==2.162.0) (2.8.2)
Requirement already satisfied: pytz>=2020.1 in /opt/conda/lib/python3.10/site-packages (from pandas->sagemaker==2.162.0) (2022.1)
Requirement already satisfied: ppft>=1.7.6.6 in /opt/conda/lib/python3.10/site-packages (from pathos->sagemaker==2.162.0) (1.7.6.6)
Requirement already satisfied: dill>=0.3.6 in /opt/conda/lib/python3.10/site-packages (from pathos->sagemaker==2.162.0) (0.3.6)
Requirement already satisfied: pox>=0.3.2 in /opt/conda/lib/python3.10/site-packages (from pathos->sagemaker==2.162.0) (0.3.2)
Requirement already satisfied: multiprocess>=0.70.14 in /opt/conda/lib/python3.10/site-packages (from pathos->sagemaker==2.162.0) (0.70.14)
Requirement already satisfied: contextlib2>=0.5.5 in /opt/conda/lib/python3.10/site-packages (from schema->sagemaker==2.162.0) (21.6.0)
Requirement already satisfied: urllib3<1.27,>=1.25.4 in /opt/conda/lib/python3.10/site-packages (from botocore<1.30.0,>=1.29.153->boto3<2.0,>=1.26.131->sagemaker==2.162.0) (1.26.16)
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

[notice] A new release of pip is available: 23.1.2 -> 23.2.1
[notice] To update, run: pip install --upgrade pip
[3]
[4]

Download Dataset

[5]
[6]
[7]
s3://sagemaker-us-east-1-681580474417/sample-dataset/abalone/abalone.csv

Define a New Pipeline

Setup

[8]

Lets define parameters which would be leveraged throught our pipeline, we can change these parameters during execution and control various aspects of our pipeline

[9]

PreProcessing

[10]
[11]
The input argument instance_type of function (sagemaker.image_uris.retrieve) is a pipeline variable (<class 'sagemaker.workflow.parameters.ParameterString'>), which is not allowed. The default_value of this Parameter object will be used to override it. Please make sure the default_value is valid.
[12]
/opt/conda/lib/python3.10/site-packages/sagemaker/workflow/pipeline_context.py:286: UserWarning: Running within a PipelineSession, there will be No Wait, No Logs, and No Job being started.
  warnings.warn(

Train

[13]
[14]
[15]

Evaluation

[16]
[17]
[18]

Create Model

[19]
[20]
[21]

Register Model

[22]
[23]
[24]

Conditional Check

[25]
[26]
[27]

Execute Pipeline

[28]
[29]
[30]
[31]
WARNING:sagemaker.workflow._utils:Popping out 'CertifyForMarketplace' from the pipeline definition since it will be overridden in pipeline execution time.
{'Version': '2020-12-01',
, 'Metadata': {},
, 'Parameters': [{'Name': 'ProcessingInstanceCount',
,   'Type': 'Integer',
,   'DefaultValue': 1},
,  {'Name': 'ProcessingInstanceType',
,   'Type': 'String',
,   'DefaultValue': 'ml.c5.xlarge'},
,  {'Name': 'TrainingInstanceCount', 'Type': 'Integer', 'DefaultValue': 1},
,  {'Name': 'TrainingInstanceType',
,   'Type': 'String',
,   'DefaultValue': 'ml.c5.xlarge'},
,  {'Name': 'XGBNumRounds', 'Type': 'Integer', 'DefaultValue': 50},
,  {'Name': 'XGBMaxDepth', 'Type': 'Integer', 'DefaultValue': 5},
,  {'Name': 'XGBETA', 'Type': 'Float', 'DefaultValue': 0.2},
,  {'Name': 'XGBGamma', 'Type': 'Integer', 'DefaultValue': 4},
,  {'Name': 'XGBMinChildWeight', 'Type': 'Integer', 'DefaultValue': 6},
,  {'Name': 'XGBSubSample', 'Type': 'Float', 'DefaultValue': 0.7},
,  {'Name': 'ModelPath',
,   'Type': 'String',
,   'DefaultValue': 's3://sagemaker-us-east-1-681580474417/Abalone/models/'},
,  {'Name': 'ApprovalStatus',
,   'Type': 'String',
,   'DefaultValue': 'PendingManualApproval'},
,  {'Name': 'InputData',
,   'Type': 'String',
,   'DefaultValue': 's3://sagemaker-us-east-1-681580474417/sample-dataset/abalone/abalone.csv'},
,  {'Name': 'MseThreshold', 'Type': 'Float', 'DefaultValue': 6.0}],
, 'PipelineExperimentConfig': {'ExperimentName': 'AbaloneExperimentsPipeline',
,  'TrialName': {'Get': 'Execution.PipelineExecutionId'}},
, 'Steps': [{'Name': 'Abalone-Preprocess',
,   'Type': 'Processing',
,   'Arguments': {'ProcessingResources': {'ClusterConfig': {'InstanceType': {'Get': 'Parameters.ProcessingInstanceType'},
,      'InstanceCount': {'Get': 'Parameters.ProcessingInstanceCount'},
,      'VolumeSizeInGB': 30}},
,    'AppSpecification': {'ImageUri': '683313688378.dkr.ecr.us-east-1.amazonaws.com/sagemaker-scikit-learn:0.23-1-cpu-py3',
,     'ContainerArguments': ['--train_size',
,      '0.7',
,      '--val_size',
,      '0.2',
,      '--test_size',
,      '0.1',
,      '--random_state',
,      '10',
,      '--cat_feature_cols',
,      'sex',
,      '--num_feature_cols',
,      'length,diameter,height,whole_weight,shucked_weight,viscera_weight,shell_weight',
,      '--target_col',
,      'rings'],
,     'ContainerEntrypoint': ['python3',
,      '/opt/ml/processing/input/code/preprocessing.py']},
,    'RoleArn': 'arn:aws:iam::681580474417:role/SageMakerCFDomainCreation-SageMakerExecutionRole-12TMZ4EI9FOSA',
,    'ProcessingInputs': [{'InputName': 'input-1',
,      'AppManaged': False,
,      'S3Input': {'S3Uri': {'Get': 'Parameters.InputData'},
,       'LocalPath': '/opt/ml/processing/input',
,       'S3DataType': 'S3Prefix',
,       'S3InputMode': 'File',
,       'S3DataDistributionType': 'FullyReplicated',
,       'S3CompressionType': 'None'}},
,     {'InputName': 'code',
,      'AppManaged': False,
,      'S3Input': {'S3Uri': 's3://sagemaker-us-east-1-681580474417/AbalonePipeline-SelectExec/code/5d9f8cf978eb635fdf8359a0de190535/preprocessing.py',
,       'LocalPath': '/opt/ml/processing/input/code',
,       'S3DataType': 'S3Prefix',
,       'S3InputMode': 'File',
,       'S3DataDistributionType': 'FullyReplicated',
,       'S3CompressionType': 'None'}}],
,    'ProcessingOutputConfig': {'Outputs': [{'OutputName': 'train',
,       'AppManaged': False,
,       'S3Output': {'S3Uri': {'Std:Join': {'On': '/',
,          'Values': ['s3:/',
,           'sagemaker-us-east-1-681580474417',
,           'AbalonePipeline-SelectExec',
,           {'Get': 'Execution.PipelineExecutionId'},
,           'Abalone-Preprocess',
,           'output',
,           'train']}},
,        'LocalPath': '/opt/ml/processing/output/train',
,        'S3UploadMode': 'EndOfJob'}},
,      {'OutputName': 'validation',
,       'AppManaged': False,
,       'S3Output': {'S3Uri': {'Std:Join': {'On': '/',
,          'Values': ['s3:/',
,           'sagemaker-us-east-1-681580474417',
,           'AbalonePipeline-SelectExec',
,           {'Get': 'Execution.PipelineExecutionId'},
,           'Abalone-Preprocess',
,           'output',
,           'validation']}},
,        'LocalPath': '/opt/ml/processing/output/validation',
,        'S3UploadMode': 'EndOfJob'}},
,      {'OutputName': 'test',
,       'AppManaged': False,
,       'S3Output': {'S3Uri': {'Std:Join': {'On': '/',
,          'Values': ['s3:/',
,           'sagemaker-us-east-1-681580474417',
,           'AbalonePipeline-SelectExec',
,           {'Get': 'Execution.PipelineExecutionId'},
,           'Abalone-Preprocess',
,           'output',
,           'test']}},
,        'LocalPath': '/opt/ml/processing/output/test',
,        'S3UploadMode': 'EndOfJob'}}]}},
,   'CacheConfig': {'Enabled': True, 'ExpireAfter': 'T12H'}},
,  {'Name': 'Abalone-Train',
,   'Type': 'Training',
,   'Arguments': {'AlgorithmSpecification': {'TrainingInputMode': 'File',
,     'TrainingImage': '683313688378.dkr.ecr.us-east-1.amazonaws.com/sagemaker-xgboost:1.0-1-cpu-py3'},
,    'OutputDataConfig': {'S3OutputPath': {'Get': 'Parameters.ModelPath'}},
,    'StoppingCondition': {'MaxRuntimeInSeconds': 86400},
,    'ResourceConfig': {'VolumeSizeInGB': 30,
,     'InstanceCount': {'Get': 'Parameters.TrainingInstanceCount'},
,     'InstanceType': 'ml.c5.xlarge'},
,    'RoleArn': 'arn:aws:iam::681580474417:role/SageMakerCFDomainCreation-SageMakerExecutionRole-12TMZ4EI9FOSA',
,    'InputDataConfig': [{'DataSource': {'S3DataSource': {'S3DataType': 'S3Prefix',
,        'S3Uri': {'Get': "Steps.Abalone-Preprocess.ProcessingOutputConfig.Outputs['train'].S3Output.S3Uri"},
,        'S3DataDistributionType': 'FullyReplicated'}},
,      'ContentType': 'text/csv',
,      'ChannelName': 'train'},
,     {'DataSource': {'S3DataSource': {'S3DataType': 'S3Prefix',
,        'S3Uri': {'Get': "Steps.Abalone-Preprocess.ProcessingOutputConfig.Outputs['validation'].S3Output.S3Uri"},
,        'S3DataDistributionType': 'FullyReplicated'}},
,      'ContentType': 'text/csv',
,      'ChannelName': 'validation'}],
,    'HyperParameters': {'objective': 'reg:linear',
,     'num_round': {'Std:Join': {'On': '',
,       'Values': [{'Get': 'Parameters.XGBNumRounds'}]}},
,     'max_depth': {'Std:Join': {'On': '',
,       'Values': [{'Get': 'Parameters.XGBMaxDepth'}]}},
,     'eta': {'Std:Join': {'On': '', 'Values': [{'Get': 'Parameters.XGBETA'}]}},
,     'gamma': {'Std:Join': {'On': '',
,       'Values': [{'Get': 'Parameters.XGBGamma'}]}},
,     'min_child_weight': {'Std:Join': {'On': '',
,       'Values': [{'Get': 'Parameters.XGBGamma'}]}},
,     'subsample': {'Std:Join': {'On': '',
,       'Values': [{'Get': 'Parameters.XGBSubSample'}]}}},
,    'DebugHookConfig': {'S3OutputPath': {'Get': 'Parameters.ModelPath'},
,     'CollectionConfigurations': []},
,    'ProfilerConfig': {'S3OutputPath': {'Get': 'Parameters.ModelPath'},
,     'DisableProfiler': False}},
,   'CacheConfig': {'Enabled': True, 'ExpireAfter': 'T12H'}},
,  {'Name': 'Abalone-Evaluate',
,   'Type': 'Processing',
,   'Arguments': {'ProcessingResources': {'ClusterConfig': {'InstanceType': {'Get': 'Parameters.ProcessingInstanceType'},
,      'InstanceCount': 1,
,      'VolumeSizeInGB': 10}},
,    'AppSpecification': {'ImageUri': '683313688378.dkr.ecr.us-east-1.amazonaws.com/sagemaker-xgboost:1.0-1-cpu-py3',
,     'ContainerEntrypoint': ['python3',
,      '/opt/ml/processing/input/code/evaluation.py']},
,    'RoleArn': 'arn:aws:iam::681580474417:role/SageMakerCFDomainCreation-SageMakerExecutionRole-12TMZ4EI9FOSA',
,    'ProcessingInputs': [{'InputName': 'input-1',
,      'AppManaged': False,
,      'S3Input': {'S3Uri': {'Get': 'Steps.Abalone-Train.ModelArtifacts.S3ModelArtifacts'},
,       'LocalPath': '/opt/ml/processing/model',
,       'S3DataType': 'S3Prefix',
,       'S3InputMode': 'File',
,       'S3DataDistributionType': 'FullyReplicated',
,       'S3CompressionType': 'None'}},
,     {'InputName': 'input-2',
,      'AppManaged': False,
,      'S3Input': {'S3Uri': {'Get': "Steps.Abalone-Preprocess.ProcessingOutputConfig.Outputs['test'].S3Output.S3Uri"},
,       'LocalPath': '/opt/ml/processing/output/test',
,       'S3DataType': 'S3Prefix',
,       'S3InputMode': 'File',
,       'S3DataDistributionType': 'FullyReplicated',
,       'S3CompressionType': 'None'}},
,     {'InputName': 'code',
,      'AppManaged': False,
,      'S3Input': {'S3Uri': 's3://sagemaker-us-east-1-681580474417/AbalonePipeline-SelectExec/code/af3d0ac9a2a46ba2e53409799b1c4dbe/evaluation.py',
,       'LocalPath': '/opt/ml/processing/input/code',
,       'S3DataType': 'S3Prefix',
,       'S3InputMode': 'File',
,       'S3DataDistributionType': 'FullyReplicated',
,       'S3CompressionType': 'None'}}],
,    'ProcessingOutputConfig': {'Outputs': [{'OutputName': 'evaluation',
,       'AppManaged': False,
,       'S3Output': {'S3Uri': 's3://sagemaker-us-east-1-681580474417/abalone-postproc-2023-07-25-20-12-29-933/output/evaluation',
,        'LocalPath': '/opt/ml/processing/evaluation',
,        'S3UploadMode': 'EndOfJob'}}]}},
,   'CacheConfig': {'Enabled': True, 'ExpireAfter': 'T12H'},
,   'PropertyFiles': [{'PropertyFileName': 'EvaluationReport',
,     'OutputName': 'evaluation',
,     'FilePath': 'evaluation.json'}]},
,  {'Name': 'Abalone-MSECheck',
,   'Type': 'Condition',
,   'Arguments': {'Conditions': [{'Type': 'LessThanOrEqualTo',
,      'LeftValue': {'Std:JsonGet': {'PropertyFile': {'Get': 'Steps.Abalone-Evaluate.PropertyFiles.EvaluationReport'},
,        'Path': 'regression_metrics.mse.value'}},
,      'RightValue': {'Get': 'Parameters.MseThreshold'}}],
,    'IfSteps': [{'Name': 'Abalone-ModelRegister-RegisterModel',
,      'Type': 'RegisterModel',
,      'Arguments': {'ModelPackageGroupName': 'Abalone-Models',
,       'ModelMetrics': {'ModelQuality': {'Statistics': {'ContentType': 'application/json',
,          'S3Uri': 's3://sagemaker-us-east-1-681580474417/abalone-postproc-2023-07-25-20-12-29-933/output/evaluation/evaluation.json'}},
,        'Bias': {},
,        'Explainability': {}},
,       'InferenceSpecification': {'Containers': [{'Image': '683313688378.dkr.ecr.us-east-1.amazonaws.com/sagemaker-xgboost:1.0-1-cpu-py3',
,          'Environment': {},
,          'ModelDataUrl': {'Get': 'Steps.Abalone-Train.ModelArtifacts.S3ModelArtifacts'}}],
,        'SupportedContentTypes': ['text/csv'],
,        'SupportedResponseMIMETypes': ['text/csv'],
,        'SupportedRealtimeInferenceInstanceTypes': ['ml.t2.medium',
,         'ml.m5.xlarge'],
,        'SupportedTransformInstanceTypes': ['ml.m5.xlarge']},
,       'ModelApprovalStatus': {'Get': 'Parameters.ApprovalStatus'}}},
,     {'Name': 'Abalone-CreateModel-CreateModel',
,      'Type': 'Model',
,      'Arguments': {'ExecutionRoleArn': 'arn:aws:iam::681580474417:role/SageMakerCFDomainCreation-SageMakerExecutionRole-12TMZ4EI9FOSA',
,       'PrimaryContainer': {'Image': '683313688378.dkr.ecr.us-east-1.amazonaws.com/sagemaker-xgboost:1.0-1-cpu-py3',
,        'Environment': {},
,        'ModelDataUrl': {'Get': 'Steps.Abalone-Train.ModelArtifacts.S3ModelArtifacts'}}}}],
,    'ElseSteps': [{'Name': 'Abalone-FailNotify',
,      'Type': 'Fail',
,      'Arguments': {'ErrorMessage': {'Std:Join': {'On': ' ',
,         'Values': ['Execution failed due to MSE >',
,          {'Get': 'Parameters.MseThreshold'}]}}}}]}}]}
[32]
{'PipelineArn': 'arn:aws:sagemaker:us-east-1:681580474417:pipeline/AbalonePipeline-SelectExec',
, 'ResponseMetadata': {'RequestId': '18bfd020-370d-4e95-ba59-b674c77832b8',
,  'HTTPStatusCode': 200,
,  'HTTPHeaders': {'x-amzn-requestid': '18bfd020-370d-4e95-ba59-b674c77832b8',
,   'content-type': 'application/x-amz-json-1.1',
,   'content-length': '94',
,   'date': 'Tue, 25 Jul 2023 20:12:33 GMT'},
,  'RetryAttempts': 0}}
[33]
[34]
{'PipelineArn': 'arn:aws:sagemaker:us-east-1:681580474417:pipeline/AbalonePipeline-SelectExec',
, 'PipelineExecutionArn': 'arn:aws:sagemaker:us-east-1:681580474417:pipeline/AbalonePipeline-SelectExec/execution/is6ph1fp4go8',
, 'PipelineExecutionDisplayName': 'execution-1690315954896',
, 'PipelineExecutionStatus': 'Executing',
, 'PipelineExperimentConfig': {'ExperimentName': 'AbaloneExperimentsPipeline',
,  'TrialName': 'is6ph1fp4go8'},
, 'CreationTime': datetime.datetime(2023, 7, 25, 20, 12, 34, 781000, tzinfo=tzlocal()),
, 'LastModifiedTime': datetime.datetime(2023, 7, 25, 20, 12, 34, 781000, tzinfo=tzlocal()),
, 'CreatedBy': {'UserProfileArn': 'arn:aws:sagemaker:us-east-1:681580474417:user-profile/d-biwxq9wovumj/ds-user',
,  'UserProfileName': 'ds-user',
,  'DomainId': 'd-biwxq9wovumj'},
, 'LastModifiedBy': {'UserProfileArn': 'arn:aws:sagemaker:us-east-1:681580474417:user-profile/d-biwxq9wovumj/ds-user',
,  'UserProfileName': 'ds-user',
,  'DomainId': 'd-biwxq9wovumj'},
, 'ResponseMetadata': {'RequestId': '8e12d252-e17c-456e-ba25-88c42feb477f',
,  'HTTPStatusCode': 200,
,  'HTTPHeaders': {'x-amzn-requestid': '8e12d252-e17c-456e-ba25-88c42feb477f',
,   'content-type': 'application/x-amz-json-1.1',
,   'content-length': '821',
,   'date': 'Tue, 25 Jul 2023 20:12:35 GMT'},
,  'RetryAttempts': 0}}
[35]

Selective Execution

[36]

Setup

[37]
[38]
[39]
'arn:aws:sagemaker:us-east-1:681580474417:pipeline/AbalonePipeline-SelectExec/execution/is6ph1fp4go8'
[40]
[41]
[{'StepName': 'Abalone-Preprocess',
,  'StartTime': datetime.datetime(2023, 7, 25, 20, 12, 35, 695000, tzinfo=tzlocal()),
,  'EndTime': datetime.datetime(2023, 7, 25, 20, 17, 1, 128000, tzinfo=tzlocal()),
,  'StepStatus': 'Succeeded',
,  'AttemptCount': 0,
,  'Metadata': {'ProcessingJob': {'Arn': 'arn:aws:sagemaker:us-east-1:681580474417:processing-job/pipelines-is6ph1fp4go8-Abalone-Preprocess-vRZZNaYdbc'}}},
, {'StepName': 'Abalone-Train',
,  'StartTime': datetime.datetime(2023, 7, 25, 20, 17, 2, 192000, tzinfo=tzlocal()),
,  'EndTime': datetime.datetime(2023, 7, 25, 20, 19, 33, 989000, tzinfo=tzlocal()),
,  'StepStatus': 'Succeeded',
,  'AttemptCount': 0,
,  'Metadata': {'TrainingJob': {'Arn': 'arn:aws:sagemaker:us-east-1:681580474417:training-job/pipelines-is6ph1fp4go8-Abalone-Train-5F3a1Eb2Zd'}}},
, {'StepName': 'Abalone-Evaluate',
,  'StartTime': datetime.datetime(2023, 7, 25, 20, 19, 34, 645000, tzinfo=tzlocal()),
,  'EndTime': datetime.datetime(2023, 7, 25, 20, 24, 4, 114000, tzinfo=tzlocal()),
,  'StepStatus': 'Succeeded',
,  'AttemptCount': 0,
,  'Metadata': {'ProcessingJob': {'Arn': 'arn:aws:sagemaker:us-east-1:681580474417:processing-job/pipelines-is6ph1fp4go8-Abalone-Evaluate-3Ntw7qvw1A'}}},
, {'StepName': 'Abalone-MSECheck',
,  'StartTime': datetime.datetime(2023, 7, 25, 20, 24, 4, 650000, tzinfo=tzlocal()),
,  'EndTime': datetime.datetime(2023, 7, 25, 20, 24, 4, 863000, tzinfo=tzlocal()),
,  'StepStatus': 'Succeeded',
,  'AttemptCount': 0,
,  'Metadata': {'Condition': {'Outcome': 'True'}}},
, {'StepName': 'Abalone-ModelRegister-RegisterModel',
,  'StartTime': datetime.datetime(2023, 7, 25, 20, 24, 5, 676000, tzinfo=tzlocal()),
,  'EndTime': datetime.datetime(2023, 7, 25, 20, 24, 6, 529000, tzinfo=tzlocal()),
,  'StepStatus': 'Succeeded',
,  'AttemptCount': 0,
,  'Metadata': {'RegisterModel': {'Arn': 'arn:aws:sagemaker:us-east-1:681580474417:model-package/abalone-models/14'}}},
, {'StepName': 'Abalone-CreateModel-CreateModel',
,  'StartTime': datetime.datetime(2023, 7, 25, 20, 24, 5, 676000, tzinfo=tzlocal()),
,  'EndTime': datetime.datetime(2023, 7, 25, 20, 24, 7, 178000, tzinfo=tzlocal()),
,  'StepStatus': 'Succeeded',
,  'AttemptCount': 0,
,  'Metadata': {'Model': {'Arn': 'arn:aws:sagemaker:us-east-1:681580474417:model/pipelines-is6ph1fp4go8-abalone-createmodel--m2fs0kxign'}}}]
[42]
[43]
[{'Name': 'XGBNumRounds', 'Value': '50'},
, {'Name': 'XGBSubSample', 'Value': '0.7'},
, {'Name': 'XGBGamma', 'Value': '4'},
, {'Name': 'TrainingInstanceCount', 'Value': '1'},
, {'Name': 'XGBMinChildWeight', 'Value': '6'},
, {'Name': 'XGBETA', 'Value': '0.2'},
, {'Name': 'ApprovalStatus', 'Value': 'PendingManualApproval'},
, {'Name': 'ProcessingInstanceCount', 'Value': '1'},
, {'Name': 'ProcessingInstanceType', 'Value': 'ml.c5.xlarge'},
, {'Name': 'MseThreshold', 'Value': '6.0'},
, {'Name': 'ModelPath',
,  'Value': 's3://sagemaker-us-east-1-681580474417/Abalone/models/'},
, {'Name': 'XGBMaxDepth', 'Value': '5'},
, {'Name': 'TrainingInstanceType', 'Value': 'ml.c5.xlarge'},
, {'Name': 'InputData',
,  'Value': 's3://sagemaker-us-east-1-681580474417/sample-dataset/abalone/abalone.csv'}]

Selective Execution Scenarios

Execute Single Pipeline Step with Changes to Parameters

I would like to retrain the model in hopes to get a better performant model with different hyper parameters without retraining the whole pipeline flow, this is useful in scenarios where a DS would prefer to just test custom hyper parameters before executing the full pipeline flow

[44]
[45]

Before:

Before Single Step

After

After Single Step

Execute Multiple Contiguous Pipeline Steps or the Entire Pipeline Manually

[46]
[ ]

Execute Contiguous Blocks of the Pipeline

Multiple Steps

OR Execute the full pipeline

Full Steps

Notebook CI Test Results

This notebook was tested in multiple regions. The test results are as follows, except for us-west-2 which is shown at the top of the notebook.

This us-east-1 badge failed to load. Check your device's internet connectivity, otherwise the service is currently unavailable

This us-east-2 badge failed to load. Check your device's internet connectivity, otherwise the service is currently unavailable

This us-west-1 badge failed to load. Check your device's internet connectivity, otherwise the service is currently unavailable

This ca-central-1 badge failed to load. Check your device's internet connectivity, otherwise the service is currently unavailable

This sa-east-1 badge failed to load. Check your device's internet connectivity, otherwise the service is currently unavailable

This eu-west-1 badge failed to load. Check your device's internet connectivity, otherwise the service is currently unavailable

This eu-west-2 badge failed to load. Check your device's internet connectivity, otherwise the service is currently unavailable

This eu-west-3 badge failed to load. Check your device's internet connectivity, otherwise the service is currently unavailable

This eu-central-1 badge failed to load. Check your device's internet connectivity, otherwise the service is currently unavailable

This eu-north-1 badge failed to load. Check your device's internet connectivity, otherwise the service is currently unavailable

This ap-southeast-1 badge failed to load. Check your device's internet connectivity, otherwise the service is currently unavailable

This ap-southeast-2 badge failed to load. Check your device's internet connectivity, otherwise the service is currently unavailable

This ap-northeast-1 badge failed to load. Check your device's internet connectivity, otherwise the service is currently unavailable

This ap-northeast-2 badge failed to load. Check your device's internet connectivity, otherwise the service is currently unavailable

This ap-south-1 badge failed to load. Check your device's internet connectivity, otherwise the service is currently unavailable

[ ]