Skip to content

change: improve documentation of some functions #864

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jul 19, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/sagemaker/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,9 +514,9 @@ def transform(self, job_name, model_name, strategy, max_concurrent_transforms, m
input_config (dict): A dictionary describing the input data (and its location) for the job.
output_config (dict): A dictionary describing the output location for the job.
resource_config (dict): A dictionary describing the resources to complete the job.
tags (list[dict]): List of tags for labeling a transform job.
tags (list[dict]): List of tags for labeling a transform job. For more information,
see https://docs.aws.amazon.com/sagemaker/latest/dg/API_Tag.html.
data_processing(dict): A dictionary describing config for combining the input data and transformed data.
For more, see https://docs.aws.amazon.com/sagemaker/latest/dg/API_Tag.html.
"""
transform_request = {
'TransformJobName': job_name,
Expand Down
2 changes: 2 additions & 0 deletions src/sagemaker/transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,10 @@ def transform(self, data, data_type='S3Prefix', content_type=None, compression_t
job_name (str): job name (default: None). If not specified, one will be generated.
input_filter (str): A JSONPath to select a portion of the input to pass to the algorithm container for
inference. If you omit the field, it gets the value '$', representing the entire input.
For more information, see https://docs.aws.amazon.com/sagemaker/latest/dg/API_CreateTransformJob.html
Some examples: "$[1:]", "$.features"(default: None).
output_filter (str): A JSONPath to select a portion of the joined/original output to return as the output.
For more information, see https://docs.aws.amazon.com/sagemaker/latest/dg/API_CreateTransformJob.html
Some examples: "$[1:]", "$.prediction" (default: None).
join_source (str): The source of data to be joined to the transform output. It can be set to 'Input'
meaning the entire input record will be joined to the inference result.
Expand Down
4 changes: 3 additions & 1 deletion tests/integ/test_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@ def test_transform_mxnet(sagemaker_session, mxnet_full_version):

kms_key_arn = get_or_create_kms_key(sagemaker_session)
output_filter = "$"
input_filter = "$"

transformer = _create_transformer_and_transform_job(mx, transform_input, kms_key_arn,
input_filter=None, output_filter=output_filter,
input_filter=input_filter, output_filter=output_filter,
join_source=None)
with timeout_and_delete_model_with_transformer(transformer, sagemaker_session,
minutes=TRANSFORM_DEFAULT_TIMEOUT_MINUTES):
Expand All @@ -67,6 +68,7 @@ def test_transform_mxnet(sagemaker_session, mxnet_full_version):
TransformJobName=transformer.latest_transform_job.name)
assert kms_key_arn == job_desc['TransformResources']['VolumeKmsKeyId']
assert output_filter == job_desc['DataProcessing']['OutputFilter']
assert input_filter == job_desc['DataProcessing']['InputFilter']


@pytest.mark.canary_quick
Expand Down
9 changes: 8 additions & 1 deletion tests/unit/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -578,17 +578,24 @@ def test_transform_pack_to_request(sagemaker_session):
'InstanceType': INSTANCE_TYPE,
}

data_processing = {
'OutputFilter': '$',
'InputFilter': '$',
'JoinSource': 'Input'
}

expected_args = {
'TransformJobName': JOB_NAME,
'ModelName': model_name,
'TransformInput': in_config,
'TransformOutput': out_config,
'TransformResources': resource_config,
'DataProcessing': data_processing,
}

sagemaker_session.transform(job_name=JOB_NAME, model_name=model_name, strategy=None, max_concurrent_transforms=None,
max_payload=None, env=None, input_config=in_config, output_config=out_config,
resource_config=resource_config, tags=None, data_processing=None)
resource_config=resource_config, tags=None, data_processing=data_processing)

_, _, actual_args = sagemaker_session.sagemaker_client.method_calls[0]
assert actual_args == expected_args
Expand Down