fix(components): Print logs for AWS SageMaker components (#4879)

* Print logs for Processing and Batch Transform

* Change image in yamls

* Add unit tests for cw calls

* update version in license file to 1.1.1

* generate yaml for the new version

* update changelog
This commit is contained in:
Kartik Kalamadi 2021-02-23 19:19:14 -08:00 committed by GitHub
parent e82aec6cd6
commit 079eea369a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 50 additions and 15 deletions

View File

@ -4,6 +4,11 @@ The version of the AWS SageMaker Components is determined by the docker image ta
Repository: https://hub.docker.com/repository/docker/amazon/aws-sagemaker-kfp-components
---------------------------------------------
**Change log for version 1.1.1**
- Print logs for Batch Transform and Processing jobs.
> Pull requests : [#4879](https://github.com/kubeflow/pipelines/pull/4879)
**Change log for version 1.1.0**
- Add SageMaker RLEstimator component
- Add RoboMaker create/delete simulation application, cerate simulation job components

View File

@ -1,4 +1,4 @@
** Amazon SageMaker Components for Kubeflow Pipelines; version 1.1.0 --
** Amazon SageMaker Components for Kubeflow Pipelines; version 1.1.1 --
https://github.com/kubeflow/pipelines/tree/master/components/aws/sagemaker
Copyright 2019-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
** boto3; version 1.14.12 -- https://github.com/boto/boto3/

View File

@ -56,7 +56,7 @@ outputs:
- {name: output_location, description: S3 URI of the transform job results.}
implementation:
container:
image: amazon/aws-sagemaker-kfp-components:1.1.0
image: amazon/aws-sagemaker-kfp-components:1.1.1
command: [python3]
args:
- batch_transform/src/sagemaker_transform_component.py

View File

@ -160,6 +160,11 @@ class SageMakerTransformComponent(SageMakerComponent):
)
)
def _print_logs_for_job(self):
self._print_cloudwatch_logs(
"/aws/sagemaker/TransformJobs", self._transform_job_name
)
if __name__ == "__main__":
import sys

View File

@ -31,7 +31,7 @@ outputs:
- {name: revision_id, description: The revision id of the simulation application.}
implementation:
container:
image: amazon/aws-sagemaker-kfp-components:1.1.0
image: amazon/aws-sagemaker-kfp-components:1.1.1
command: [python3]
args:
- create_simulation_app/src/robomaker_create_simulation_app_component.py

View File

@ -16,7 +16,7 @@ outputs:
- {name: arn, description: The Amazon Resource Name (ARN) of the simulation application.}
implementation:
container:
image: amazon/aws-sagemaker-kfp-components:1.1.0
image: amazon/aws-sagemaker-kfp-components:1.1.1
command: [python3]
args:
- delete_simulation_app/src/robomaker_delete_simulation_app_component.py

View File

@ -64,7 +64,7 @@ outputs:
- {name: endpoint_name, description: The created endpoint name.}
implementation:
container:
image: amazon/aws-sagemaker-kfp-components:1.1.0
image: amazon/aws-sagemaker-kfp-components:1.1.1
command: [python3]
args:
- deploy/src/sagemaker_deploy_component.py

View File

@ -79,7 +79,7 @@ outputs:
SageMaker model trained as part of automated data labeling.}
implementation:
container:
image: amazon/aws-sagemaker-kfp-components:1.1.0
image: amazon/aws-sagemaker-kfp-components:1.1.1
command: [python3]
args:
- ground_truth/src/sagemaker_ground_truth_component.py

View File

@ -98,7 +98,7 @@ outputs:
the training algorithm.}
implementation:
container:
image: amazon/aws-sagemaker-kfp-components:1.1.0
image: amazon/aws-sagemaker-kfp-components:1.1.1
command: [python3]
args:
- hyperparameter_tuning/src/sagemaker_tuning_component.py

View File

@ -37,7 +37,7 @@ outputs:
- {name: model_name, description: The name of the model created by SageMaker.}
implementation:
container:
image: amazon/aws-sagemaker-kfp-components:1.1.0
image: amazon/aws-sagemaker-kfp-components:1.1.1
command: [python3]
args:
- model/src/sagemaker_model_component.py

View File

@ -57,7 +57,7 @@ outputs:
- {name: output_artifacts, description: A dictionary containing the output S3 artifacts.}
implementation:
container:
image: amazon/aws-sagemaker-kfp-components:1.1.0
image: amazon/aws-sagemaker-kfp-components:1.1.1
command: [python3]
args:
- process/src/sagemaker_process_component.py

View File

@ -180,6 +180,11 @@ class SageMakerProcessComponent(SageMakerComponent):
)
)
def _print_logs_for_job(self):
self._print_cloudwatch_logs(
"/aws/sagemaker/ProcessingJobs", self._processing_job_name
)
def _get_job_outputs(self):
"""Map the S3 outputs of a processing job to a dictionary object.

View File

@ -76,7 +76,7 @@ outputs:
the training algorithm.}
implementation:
container:
image: amazon/aws-sagemaker-kfp-components:1.1.0
image: amazon/aws-sagemaker-kfp-components:1.1.1
command: [python3]
args:
- rlestimator/src/sagemaker_rlestimator_component.py

View File

@ -53,7 +53,7 @@ outputs:
- {name: job_id, description: The simulation job id.}
implementation:
container:
image: amazon/aws-sagemaker-kfp-components:1.1.0
image: amazon/aws-sagemaker-kfp-components:1.1.1
command: [python3]
args:
- simulation_job/src/robomaker_simulation_job_component.py

View File

@ -24,7 +24,7 @@ outputs:
- {name: batch_job_id, description: The simulation job batch id.}
implementation:
container:
image: amazon/aws-sagemaker-kfp-components:1.1.0
image: amazon/aws-sagemaker-kfp-components:1.1.1
command: [python3]
args:
- simulation_job_batch/src/robomaker_simulation_job_batch_component.py

View File

@ -39,6 +39,13 @@ class TransformComponentTestCase(unittest.TestCase):
"BatchTransform-generated", self.component._transform_job_name
)
@patch("common.sagemaker_component.SageMakerComponent._print_cloudwatch_logs")
def test_cw_logs(self, mocked_super_component):
self.component._print_logs_for_job()
self.component._print_cloudwatch_logs.assert_called_once_with(
"/aws/sagemaker/TransformJobs", self.component._transform_job_name
)
def test_create_transform_job(self):
spec = SageMakerTransformSpec(self.REQUIRED_ARGS)
request = self.component._create_job_request(spec.inputs, spec.outputs)

View File

@ -23,7 +23,6 @@ class ProcessComponentTestCase(unittest.TestCase):
self.REQUIRED_ARGS + ["--job_name", "job-name"]
)
unnamed_spec = SageMakerProcessSpec(self.REQUIRED_ARGS)
self.component.Do(named_spec)
self.assertEqual("job-name", self.component._processing_job_name)
@ -34,6 +33,13 @@ class ProcessComponentTestCase(unittest.TestCase):
self.component.Do(unnamed_spec)
self.assertEqual("unique", self.component._processing_job_name)
@patch("common.sagemaker_component.SageMakerComponent._print_cloudwatch_logs")
def test_cw_logs(self, mocked_super_component):
self.component._print_logs_for_job()
self.component._print_cloudwatch_logs.assert_called_once_with(
"/aws/sagemaker/ProcessingJobs", self.component._processing_job_name
)
def test_create_process_job(self):
spec = SageMakerProcessSpec(self.REQUIRED_ARGS)
request = self.component._create_job_request(spec.inputs, spec.outputs)

View File

@ -36,6 +36,13 @@ class TrainingComponentTestCase(unittest.TestCase):
self.component.Do(unnamed_spec)
self.assertEqual("unique", self.component._training_job_name)
@patch("common.sagemaker_component.SageMakerComponent._print_cloudwatch_logs")
def test_cw_logs(self, mocked_super_component):
self.component._print_logs_for_job()
self.component._print_cloudwatch_logs.assert_called_once_with(
"/aws/sagemaker/TrainingJobs", self.component._training_job_name
)
def test_create_training_job(self):
spec = SageMakerTrainingSpec(self.REQUIRED_ARGS)
request = self.component._create_job_request(spec.inputs, spec.outputs)

View File

@ -72,7 +72,7 @@ outputs:
the training algorithm.}
implementation:
container:
image: amazon/aws-sagemaker-kfp-components:1.1.0
image: amazon/aws-sagemaker-kfp-components:1.1.1
command: [python3]
args:
- train/src/sagemaker_training_component.py

View File

@ -22,7 +22,7 @@ outputs:
- {name: workteam_arn, description: The ARN of the workteam.}
implementation:
container:
image: amazon/aws-sagemaker-kfp-components:1.1.0
image: amazon/aws-sagemaker-kfp-components:1.1.1
command: [python3]
args:
- workteam/src/sagemaker_workteam_component.py