Skip to content

Commit f89b7d1

Browse files
committed
fix: minor processing changes (instance_count + docs) (#279)
* fix: require instance_count * fix: include output_name in generated ProcessingOutput s3 uri * doc: clarify default s3 URIs
1 parent 6da0ab5 commit f89b7d1

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

src/sagemaker/processing.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ def _normalize_outputs(self, outputs=None):
250250
self.sagemaker_session.default_bucket(),
251251
self._current_job_name,
252252
"output",
253+
output.output_name,
253254
)
254255
output.destination = s3_uri
255256
normalized_outputs.append(output)
@@ -402,7 +403,7 @@ def _get_user_script_name(self, code):
402403
"""
403404
if os.path.isdir(code) is None or not os.path.splitext(code)[1]:
404405
raise ValueError(
405-
"""You cannot provide a directory. Please package your code inside of a .whl
406+
"""code must be a file, not a directory. Please package your code inside of a .whl
406407
file and pass that in, instead.
407408
"""
408409
)
@@ -593,7 +594,9 @@ def __init__(
593594
to turn those parameters into a dictionary.
594595
595596
Args:
596-
source (str): The source for the input.
597+
source (str): The source for the input. If a local path is provided, it will
598+
automatically be uploaded to s3 under:
599+
"s3://<default-bucket-name>/<job-name>/input/<input-name>".
597600
destination (str): The destination of the input.
598601
input_name (str): The user-provided name for the input. If a name
599602
is not provided, one will be generated (eg. "input-1").
@@ -647,7 +650,8 @@ def __init__(self, source, destination=None, output_name=None, s3_upload_mode="E
647650
Args:
648651
source (str): The source for the output.
649652
destination (str): The destination of the output. If a destination
650-
is not provided, one will be generated (eg. "s3://bucket/job_name/output").
653+
is not provided, one will be generated:
654+
"s3://<default-bucket-name>/<job-name>/output/<output-name>".
651655
output_name (str): The name of the output. If a name
652656
is not provided, one will be generated (eg. "output-1").
653657
s3_upload_mode (str): Valid options are "EndOfJob" or "Continuous".

src/sagemaker/sklearn/processing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def __init__(
3232
role,
3333
command,
3434
instance_type,
35-
instance_count=1,
35+
instance_count,
3636
py_version="py3",
3737
volume_size_in_gb=30,
3838
volume_kms_key=None,

tests/integ/test_processing.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ def test_sklearn(sagemaker_session, sklearn_full_version, cpu_instance_type):
6666
framework_version=sklearn_full_version,
6767
role=ROLE,
6868
instance_type=cpu_instance_type,
69+
instance_count=1,
6970
command=["python3"],
7071
sagemaker_session=sagemaker_session,
7172
max_runtime_in_seconds=3600, # TODO-reinvent-2019: REMOVE
@@ -103,6 +104,7 @@ def test_sklearn_with_customizations(
103104
role=ROLE,
104105
command=["python3"],
105106
instance_type=cpu_instance_type,
107+
instance_count=1,
106108
py_version="py3",
107109
volume_size_in_gb=100,
108110
volume_kms_key=None,
@@ -178,6 +180,7 @@ def test_sklearn_with_no_inputs_or_outputs(
178180
role=ROLE,
179181
command=["python3"],
180182
instance_type=cpu_instance_type,
183+
instance_count=1,
181184
py_version="py3",
182185
volume_size_in_gb=100,
183186
volume_kms_key=None,

tests/unit/test_processing.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ def test_sklearn(sagemaker_session):
4949
command=["python3"],
5050
role=ROLE,
5151
instance_type="ml.m4.xlarge",
52+
instance_count=1,
5253
sagemaker_session=sagemaker_session,
5354
)
5455

@@ -117,6 +118,7 @@ def test_sklearn_with_no_inputs(sagemaker_session):
117118
role=ROLE,
118119
command=["python3"],
119120
instance_type="ml.m4.xlarge",
121+
instance_count=1,
120122
sagemaker_session=sagemaker_session,
121123
)
122124

@@ -169,6 +171,7 @@ def test_sklearn_with_all_customizations(sagemaker_session):
169171
role=ROLE,
170172
command=["python3"],
171173
instance_type="ml.m4.xlarge",
174+
instance_count=1,
172175
py_version="py3",
173176
volume_size_in_gb=100,
174177
volume_kms_key=None,

0 commit comments

Comments
 (0)