Skip to content

Commit 35863e2

Browse files
committed
documentation: sync upstream
1 parent 0026f6b commit 35863e2

27 files changed

+3473
-54
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## v2.77.1 (2022-02-25)
4+
5+
### Bug Fixes and Other Changes
6+
7+
* jumpstart model table
8+
39
## v2.77.0 (2022-02-22)
410

511
### Features

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.77.1.dev0
1+
2.77.2.dev0

src/sagemaker/image_uri_config/neo-tensorflow.json

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"1.11.0": "1.15.3",
1313
"1.12.0": "1.15.3",
1414
"1.13.0": "1.15.3",
15-
"1.14.0": "1.15.3"
15+
"1.14.0": "1.15.3",
16+
"2.4.2": "2.4.2"
1617
},
1718
"versions": {
1819
"1.15.3": {
@@ -44,6 +45,36 @@
4445
"us-west-2": "301217895009"
4546
},
4647
"repository": "sagemaker-inference-tensorflow"
48+
},
49+
"2.4.2": {
50+
"py_versions": ["py3"],
51+
"registries": {
52+
"af-south-1": "774647643957",
53+
"ap-east-1": "110948597952",
54+
"ap-northeast-1": "941853720454",
55+
"ap-northeast-2": "151534178276",
56+
"ap-northeast-3": "925152966179",
57+
"ap-south-1": "763008648453",
58+
"ap-southeast-1": "324986816169",
59+
"ap-southeast-2": "355873309152",
60+
"ca-central-1": "464438896020",
61+
"cn-north-1": "472730292857",
62+
"cn-northwest-1": "474822919863",
63+
"eu-central-1": "746233611703",
64+
"eu-north-1": "601324751636",
65+
"eu-south-1": "966458181534",
66+
"eu-west-1": "802834080501",
67+
"eu-west-2": "205493899709",
68+
"eu-west-3": "254080097072",
69+
"me-south-1": "836785723513",
70+
"sa-east-1": "756306329178",
71+
"us-east-1": "785573368785",
72+
"us-east-2": "007439368137",
73+
"us-gov-west-1": "263933020539",
74+
"us-west-1": "710691900526",
75+
"us-west-2": "301217895009"
76+
},
77+
"repository": "sagemaker-inference-tensorflow"
4778
}
4879
}
4980
}

src/sagemaker/serializers.py

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import csv
1919
import io
2020
import json
21-
2221
import numpy as np
2322
from six import with_metaclass
2423

@@ -357,3 +356,37 @@ def serialize(self, data):
357356
return data.read()
358357

359358
raise ValueError("Unable to handle input format: %s" % type(data))
359+
360+
361+
class DataSerializer(SimpleBaseSerializer):
362+
"""Serialize data in any file by extracting raw bytes from the file."""
363+
364+
def __init__(self, content_type="file-path/raw-bytes"):
365+
"""Initialize a ``DataSerializer`` instance.
366+
367+
Args:
368+
content_type (str): The MIME type to signal to the inference endpoint when sending
369+
request data (default: "file-path/raw-bytes").
370+
"""
371+
super(DataSerializer, self).__init__(content_type=content_type)
372+
373+
def serialize(self, data):
374+
"""Serialize file data to a raw bytes.
375+
376+
Args:
377+
data (object): Data to be serialized. The data can be a string
378+
representing file-path or the raw bytes from a file.
379+
Returns:
380+
raw-bytes: The data serialized as raw-bytes from the input.
381+
"""
382+
if isinstance(data, str):
383+
try:
384+
with open(data, "rb") as data_file:
385+
data_file_info = data_file.read()
386+
return data_file_info
387+
except Exception as e:
388+
raise ValueError(f"Could not open/read file: {data}. {e}")
389+
if isinstance(data, bytes):
390+
return data
391+
392+
raise ValueError(f"Object of type {type(data)} is not Data serializable.")

src/sagemaker/workflow/steps.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,8 @@ def arguments(self) -> RequestType:
301301
)
302302
request_dict = self.estimator.sagemaker_session._get_train_request(**train_args)
303303
request_dict.pop("TrainingJobName")
304+
if "HyperParameters" in request_dict:
305+
request_dict["HyperParameters"].pop("sagemaker_job_name", None)
304306

305307
return request_dict
306308

tests/data/cuteCat.raw

6.43 KB
Binary file not shown.

tests/integ/__init__.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,6 @@
148148
"eu-west-2",
149149
"us-east-1",
150150
]
151-
NO_SM_PIPELINE_MM_CLARIFY_CHECK_STEP_REGIONS = [
152-
"ap-northeast-3",
153-
"ap-south-1",
154-
"eu-north-1",
155-
"sa-east-1",
156-
]
157151
EDGE_PACKAGING_SUPPORTED_REGIONS = [
158152
"us-east-2",
159153
"us-west-2",

tests/integ/sagemaker/lineage/conftest.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@
2626
artifact,
2727
)
2828
from sagemaker.model import ModelPackage
29-
from tests.integ.test_workflow import test_end_to_end_pipeline_successful_execution
29+
from tests.integ.sagemaker.workflow.test_workflow import (
30+
test_end_to_end_pipeline_successful_execution,
31+
)
3032
from sagemaker.workflow.pipeline import _PipelineExecution
3133
from sagemaker.session import get_execution_role
3234
from smexperiments import trial_component, trial, experiment

tests/integ/sagemaker/workflow/__init__.py

Whitespace-only changes.
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
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+
from __future__ import absolute_import
14+
15+
import re
16+
17+
import pytest
18+
19+
from sagemaker import get_execution_role, utils
20+
from sagemaker.workflow.callback_step import CallbackOutput, CallbackStep, CallbackOutputTypeEnum
21+
from sagemaker.workflow.parameters import ParameterInteger
22+
from sagemaker.workflow.pipeline import Pipeline
23+
24+
25+
@pytest.fixture
26+
def role(sagemaker_session):
27+
return get_execution_role(sagemaker_session)
28+
29+
30+
@pytest.fixture
31+
def pipeline_name():
32+
return utils.unique_name_from_base("my-pipeline-callback")
33+
34+
35+
@pytest.fixture
36+
def region_name(sagemaker_session):
37+
return sagemaker_session.boto_session.region_name
38+
39+
40+
def test_one_step_callback_pipeline(sagemaker_session, role, pipeline_name, region_name):
41+
instance_count = ParameterInteger(name="InstanceCount", default_value=2)
42+
43+
outputParam1 = CallbackOutput(output_name="output1", output_type=CallbackOutputTypeEnum.String)
44+
step_callback = CallbackStep(
45+
name="callback-step",
46+
sqs_queue_url="https://sqs.us-east-2.amazonaws.com/123456789012/MyQueue",
47+
inputs={"arg1": "foo"},
48+
outputs=[outputParam1],
49+
)
50+
51+
pipeline = Pipeline(
52+
name=pipeline_name,
53+
parameters=[instance_count],
54+
steps=[step_callback],
55+
sagemaker_session=sagemaker_session,
56+
)
57+
58+
try:
59+
response = pipeline.create(role)
60+
create_arn = response["PipelineArn"]
61+
assert re.match(
62+
rf"arn:aws:sagemaker:{region_name}:\d{{12}}:pipeline/{pipeline_name}",
63+
create_arn,
64+
)
65+
66+
pipeline.parameters = [ParameterInteger(name="InstanceCount", default_value=1)]
67+
response = pipeline.update(role)
68+
update_arn = response["PipelineArn"]
69+
assert re.match(
70+
rf"arn:aws:sagemaker:{region_name}:\d{{12}}:pipeline/{pipeline_name}",
71+
update_arn,
72+
)
73+
finally:
74+
try:
75+
pipeline.delete()
76+
except Exception:
77+
pass
78+
79+
80+
def test_two_step_callback_pipeline_with_output_reference(
81+
sagemaker_session, role, pipeline_name, region_name
82+
):
83+
instance_count = ParameterInteger(name="InstanceCount", default_value=2)
84+
85+
outputParam1 = CallbackOutput(output_name="output1", output_type=CallbackOutputTypeEnum.String)
86+
step_callback1 = CallbackStep(
87+
name="callback-step1",
88+
sqs_queue_url="https://sqs.us-east-2.amazonaws.com/123456789012/MyQueue",
89+
inputs={"arg1": "foo"},
90+
outputs=[outputParam1],
91+
)
92+
93+
step_callback2 = CallbackStep(
94+
name="callback-step2",
95+
sqs_queue_url="https://sqs.us-east-2.amazonaws.com/123456789012/MyQueue",
96+
inputs={"arg1": outputParam1},
97+
outputs=[],
98+
)
99+
100+
pipeline = Pipeline(
101+
name=pipeline_name,
102+
parameters=[instance_count],
103+
steps=[step_callback1, step_callback2],
104+
sagemaker_session=sagemaker_session,
105+
)
106+
107+
try:
108+
response = pipeline.create(role)
109+
create_arn = response["PipelineArn"]
110+
assert re.match(
111+
rf"arn:aws:sagemaker:{region_name}:\d{{12}}:pipeline/{pipeline_name}",
112+
create_arn,
113+
)
114+
finally:
115+
try:
116+
pipeline.delete()
117+
except Exception:
118+
pass

tests/integ/test_workflow_with_clarify_check_steps.py renamed to tests/integ/sagemaker/workflow/test_clarify_check_steps.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import pytest
2020
from botocore.exceptions import WaiterError
2121

22-
import tests
2322
from sagemaker.clarify import (
2423
BiasConfig,
2524
DataConfig,
@@ -129,10 +128,6 @@ def data_bias_check_config(data_config, bias_config):
129128
)
130129

131130

132-
@pytest.mark.skipif(
133-
tests.integ.test_region() in tests.integ.NO_SM_PIPELINE_MM_CLARIFY_CHECK_STEP_REGIONS,
134-
reason=f"ClarifyCheckStep is not fully deployed in {tests.integ.test_region()}.",
135-
)
136131
def test_one_step_data_bias_pipeline_happycase(
137132
sagemaker_session,
138133
role,
@@ -220,10 +215,6 @@ def test_one_step_data_bias_pipeline_happycase(
220215
pass
221216

222217

223-
@pytest.mark.skipif(
224-
tests.integ.test_region() in tests.integ.NO_SM_PIPELINE_MM_CLARIFY_CHECK_STEP_REGIONS,
225-
reason=f"ClarifyCheckStep is not fully deployed in {tests.integ.test_region()}.",
226-
)
227218
def test_one_step_data_bias_pipeline_constraint_violation(
228219
sagemaker_session,
229220
role,
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
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+
from __future__ import absolute_import
14+
15+
import re
16+
17+
import pytest
18+
19+
from sagemaker import get_execution_role, utils
20+
from sagemaker.workflow.emr_step import EMRStep, EMRStepConfig
21+
from sagemaker.workflow.parameters import ParameterInteger
22+
from sagemaker.workflow.pipeline import Pipeline
23+
24+
25+
@pytest.fixture
26+
def role(sagemaker_session):
27+
return get_execution_role(sagemaker_session)
28+
29+
30+
@pytest.fixture
31+
def pipeline_name():
32+
return utils.unique_name_from_base("my-pipeline-emr")
33+
34+
35+
@pytest.fixture
36+
def region_name(sagemaker_session):
37+
return sagemaker_session.boto_session.region_name
38+
39+
40+
def test_two_steps_emr_pipeline(sagemaker_session, role, pipeline_name, region_name):
41+
instance_count = ParameterInteger(name="InstanceCount", default_value=2)
42+
43+
emr_step_config = EMRStepConfig(
44+
jar="s3://us-west-2.elasticmapreduce/libs/script-runner/script-runner.jar",
45+
args=["dummy_emr_script_path"],
46+
)
47+
48+
step_emr_1 = EMRStep(
49+
name="emr-step-1",
50+
cluster_id="j-1YONHTCP3YZKC",
51+
display_name="emr_step_1",
52+
description="MyEMRStepDescription",
53+
step_config=emr_step_config,
54+
)
55+
56+
step_emr_2 = EMRStep(
57+
name="emr-step-2",
58+
cluster_id=step_emr_1.properties.ClusterId,
59+
display_name="emr_step_2",
60+
description="MyEMRStepDescription",
61+
step_config=emr_step_config,
62+
)
63+
64+
pipeline = Pipeline(
65+
name=pipeline_name,
66+
parameters=[instance_count],
67+
steps=[step_emr_1, step_emr_2],
68+
sagemaker_session=sagemaker_session,
69+
)
70+
71+
try:
72+
response = pipeline.create(role)
73+
create_arn = response["PipelineArn"]
74+
assert re.match(
75+
rf"arn:aws:sagemaker:{region_name}:\d{{12}}:pipeline/{pipeline_name}",
76+
create_arn,
77+
)
78+
finally:
79+
try:
80+
pipeline.delete()
81+
except Exception:
82+
pass

0 commit comments

Comments
 (0)