Skip to content

Commit 28e182e

Browse files
authored
Merge branch 'dev' into feat/override-jumpstart-content-bucket
2 parents b095a46 + a765512 commit 28e182e

File tree

14 files changed

+735
-236
lines changed

14 files changed

+735
-236
lines changed

README.rst

+1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ SageMaker Python SDK is tested on:
9090
- Python 3.6
9191
- Python 3.7
9292
- Python 3.8
93+
- Python 3.9
9394

9495
AWS Permissions
9596
~~~~~~~~~~~~~~~

doc/workflows/pipelines/sagemaker.workflow.pipelines.rst

+2
Original file line numberDiff line numberDiff line change
@@ -147,3 +147,5 @@ Steps
147147
.. autoclass:: sagemaker.workflow.clarify_check_step.ClarifyCheckConfig
148148

149149
.. autoclass:: sagemaker.workflow.clarify_check_step.ClarifyCheckStep
150+
151+
.. autoclass:: sagemaker.workflow.fail_step.FailStep

setup.py

+23-21
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def read_version():
3333

3434
# Declare minimal set for installation
3535
required_packages = [
36-
"attrs",
36+
"attrs==20.3.0",
3737
"boto3>=1.20.21",
3838
"google-pasta",
3939
"numpy>=1.9.0",
@@ -49,36 +49,38 @@ def read_version():
4949
# Specific use case dependencies
5050
extras = {
5151
"local": [
52-
"urllib3>=1.21.1,!=1.25,!=1.25.1",
53-
"docker-compose>=1.25.2",
54-
"docker==5.0.0",
55-
"PyYAML>=5.3, <6", # PyYAML version has to match docker-compose requirements
52+
"urllib3==1.26.8",
53+
"docker-compose==1.29.2",
54+
"docker~=5.0.0",
55+
"PyYAML==5.4.1", # PyYAML version has to match docker-compose requirements
5656
],
57-
"scipy": ["scipy>=0.19.0"],
57+
"scipy": ["scipy==1.5.4"],
5858
}
5959
# Meta dependency groups
6060
extras["all"] = [item for group in extras.values() for item in group]
6161
# Tests specific dependencies (do not need to be included in 'all')
6262
extras["test"] = (
6363
[
6464
extras["all"],
65-
"tox",
66-
"flake8",
67-
"pytest<6.1.0",
68-
"pytest-cov",
69-
"pytest-rerunfailures",
70-
"pytest-timeout",
65+
"tox==3.24.5",
66+
"flake8==4.0.1",
67+
"pytest==6.0.2",
68+
"pytest-cov==3.0.0",
69+
"pytest-rerunfailures==10.2",
70+
"pytest-timeout==2.1.0",
7171
"pytest-xdist==2.4.0",
72-
"coverage<6.2",
73-
"mock",
74-
"contextlib2",
75-
"awslogs",
76-
"black",
72+
"coverage>=5.2, <6.2",
73+
"mock==4.0.3",
74+
"contextlib2==21.6.0",
75+
"awslogs==0.14.0",
76+
"black==22.1.0",
7777
"stopit==1.1.2",
78-
"apache-airflow==1.10.11",
79-
"fabric>=2.0",
80-
"requests>=2.20.0, <3",
81-
"sagemaker-experiments",
78+
"apache-airflow==2.2.3",
79+
"apache-airflow-providers-amazon==3.0.0",
80+
"attrs==20.3.0",
81+
"fabric==2.6.0",
82+
"requests==2.27.1",
83+
"sagemaker-experiments==0.1.35",
8284
],
8385
)
8486

src/sagemaker/model.py

+1-35
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import sagemaker
2424
from sagemaker import (
2525
fw_utils,
26-
image_uris,
2726
local,
2827
s3,
2928
session,
@@ -657,34 +656,6 @@ def _compilation_job_config(
657656
"job_name": job_name,
658657
}
659658

660-
def _compilation_image_uri(self, region, target_instance_type, framework, framework_version):
661-
"""Retrieve the Neo or Inferentia image URI.
662-
663-
Args:
664-
region (str): The AWS region.
665-
target_instance_type (str): Identifies the device on which you want to run
666-
your model after compilation, for example: ml_c5. For valid values, see
667-
https://docs.aws.amazon.com/sagemaker/latest/dg/API_OutputConfig.html.
668-
framework (str): The framework name.
669-
framework_version (str): The framework version.
670-
"""
671-
framework_prefix = ""
672-
framework_suffix = ""
673-
674-
if framework == "xgboost":
675-
framework_suffix = "-neo"
676-
elif target_instance_type.startswith("ml_inf"):
677-
framework_prefix = "inferentia-"
678-
else:
679-
framework_prefix = "neo-"
680-
681-
return image_uris.retrieve(
682-
"{}{}{}".format(framework_prefix, framework, framework_suffix),
683-
region,
684-
instance_type=target_instance_type,
685-
version=framework_version,
686-
)
687-
688659
def package_for_edge(
689660
self,
690661
output_path,
@@ -849,12 +820,7 @@ def compile(
849820
if target_instance_family == "ml_eia2":
850821
pass
851822
elif target_instance_family.startswith("ml_"):
852-
self.image_uri = self._compilation_image_uri(
853-
self.sagemaker_session.boto_region_name,
854-
target_instance_family,
855-
framework,
856-
framework_version,
857-
)
823+
self.image_uri = job_status.get("InferenceImage", None)
858824
self._is_compiled_model = True
859825
else:
860826
LOGGER.warning(

src/sagemaker/workflow/fail_step.py

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"). You
4+
# may not use this file except in compliance with the License. A copy of
5+
# the License is located at
6+
#
7+
# http://aws.amazon.com/apache2.0/
8+
#
9+
# or in the "license" file accompanying this file. This file is
10+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11+
# ANY KIND, either express or implied. See the License for the specific
12+
# language governing permissions and limitations under the License.
13+
"""The `Step` definitions for SageMaker Pipelines Workflows."""
14+
from __future__ import absolute_import
15+
16+
from typing import List, Union
17+
18+
from sagemaker.workflow import PipelineNonPrimitiveInputTypes
19+
from sagemaker.workflow.entities import (
20+
RequestType,
21+
)
22+
from sagemaker.workflow.steps import Step, StepTypeEnum
23+
24+
25+
class FailStep(Step):
26+
"""`FailStep` for SageMaker Pipelines Workflows."""
27+
28+
def __init__(
29+
self,
30+
name: str,
31+
error_message: Union[str, PipelineNonPrimitiveInputTypes] = None,
32+
display_name: str = None,
33+
description: str = None,
34+
depends_on: Union[List[str], List[Step]] = None,
35+
):
36+
"""Constructs a `FailStep`.
37+
38+
Args:
39+
name (str): The name of the `FailStep`. A name is required and must be
40+
unique within a pipeline.
41+
error_message (str or PipelineNonPrimitiveInputTypes):
42+
An error message defined by the user.
43+
Once the `FailStep` is reached, the execution fails and the
44+
error message is set as the failure reason (default: None).
45+
display_name (str): The display name of the `FailStep`.
46+
The display name provides better UI readability. (default: None).
47+
description (str): The description of the `FailStep` (default: None).
48+
depends_on (List[str] or List[Step]): A list of `Step` names or `Step` instances
49+
that this `FailStep` depends on.
50+
If a listed `Step` name does not exist, an error is returned (default: None).
51+
"""
52+
super(FailStep, self).__init__(
53+
name, display_name, description, StepTypeEnum.FAIL, depends_on
54+
)
55+
self.error_message = error_message if error_message is not None else ""
56+
57+
@property
58+
def arguments(self) -> RequestType:
59+
"""The arguments dictionary that is used to define the `FailStep`."""
60+
return dict(ErrorMessage=self.error_message)
61+
62+
@property
63+
def properties(self):
64+
"""A `Properties` object is not available for the `FailStep`.
65+
66+
Executing a `FailStep` will terminate the pipeline.
67+
`FailStep` properties should not be referenced.
68+
"""
69+
raise RuntimeError(
70+
"FailStep is a terminal step and the Properties object is not available for it."
71+
)

0 commit comments

Comments
 (0)