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:
		
							parent
							
								
									e82aec6cd6
								
							
						
					
					
						commit
						079eea369a
					
				|  | @ -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 | 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** | **Change log for version 1.1.0** | ||||||
| - Add SageMaker RLEstimator component | - Add SageMaker RLEstimator component | ||||||
| - Add RoboMaker create/delete simulation application, cerate simulation job components | - Add RoboMaker create/delete simulation application, cerate simulation job components | ||||||
|  |  | ||||||
|  | @ -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 | https://github.com/kubeflow/pipelines/tree/master/components/aws/sagemaker | ||||||
| Copyright 2019-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. | Copyright 2019-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||||||
| ** boto3; version 1.14.12 -- https://github.com/boto/boto3/ | ** boto3; version 1.14.12 -- https://github.com/boto/boto3/ | ||||||
|  |  | ||||||
|  | @ -56,7 +56,7 @@ outputs: | ||||||
| - {name: output_location, description: S3 URI of the transform job results.} | - {name: output_location, description: S3 URI of the transform job results.} | ||||||
| implementation: | implementation: | ||||||
|   container: |   container: | ||||||
|     image: amazon/aws-sagemaker-kfp-components:1.1.0 |     image: amazon/aws-sagemaker-kfp-components:1.1.1 | ||||||
|     command: [python3] |     command: [python3] | ||||||
|     args: |     args: | ||||||
|     - batch_transform/src/sagemaker_transform_component.py |     - batch_transform/src/sagemaker_transform_component.py | ||||||
|  |  | ||||||
|  | @ -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__": | if __name__ == "__main__": | ||||||
|     import sys |     import sys | ||||||
|  |  | ||||||
|  | @ -31,7 +31,7 @@ outputs: | ||||||
| - {name: revision_id, description: The revision id of the simulation application.} | - {name: revision_id, description: The revision id of the simulation application.} | ||||||
| implementation: | implementation: | ||||||
|   container: |   container: | ||||||
|     image: amazon/aws-sagemaker-kfp-components:1.1.0 |     image: amazon/aws-sagemaker-kfp-components:1.1.1 | ||||||
|     command: [python3] |     command: [python3] | ||||||
|     args: |     args: | ||||||
|     - create_simulation_app/src/robomaker_create_simulation_app_component.py |     - create_simulation_app/src/robomaker_create_simulation_app_component.py | ||||||
|  |  | ||||||
|  | @ -16,7 +16,7 @@ outputs: | ||||||
| - {name: arn, description: The Amazon Resource Name (ARN) of the simulation application.} | - {name: arn, description: The Amazon Resource Name (ARN) of the simulation application.} | ||||||
| implementation: | implementation: | ||||||
|   container: |   container: | ||||||
|     image: amazon/aws-sagemaker-kfp-components:1.1.0 |     image: amazon/aws-sagemaker-kfp-components:1.1.1 | ||||||
|     command: [python3] |     command: [python3] | ||||||
|     args: |     args: | ||||||
|     - delete_simulation_app/src/robomaker_delete_simulation_app_component.py |     - delete_simulation_app/src/robomaker_delete_simulation_app_component.py | ||||||
|  |  | ||||||
|  | @ -64,7 +64,7 @@ outputs: | ||||||
| - {name: endpoint_name, description: The created endpoint name.} | - {name: endpoint_name, description: The created endpoint name.} | ||||||
| implementation: | implementation: | ||||||
|   container: |   container: | ||||||
|     image: amazon/aws-sagemaker-kfp-components:1.1.0 |     image: amazon/aws-sagemaker-kfp-components:1.1.1 | ||||||
|     command: [python3] |     command: [python3] | ||||||
|     args: |     args: | ||||||
|     - deploy/src/sagemaker_deploy_component.py |     - deploy/src/sagemaker_deploy_component.py | ||||||
|  |  | ||||||
|  | @ -79,7 +79,7 @@ outputs: | ||||||
|     SageMaker model trained as part of automated data labeling.} |     SageMaker model trained as part of automated data labeling.} | ||||||
| implementation: | implementation: | ||||||
|   container: |   container: | ||||||
|     image: amazon/aws-sagemaker-kfp-components:1.1.0 |     image: amazon/aws-sagemaker-kfp-components:1.1.1 | ||||||
|     command: [python3] |     command: [python3] | ||||||
|     args: |     args: | ||||||
|     - ground_truth/src/sagemaker_ground_truth_component.py |     - ground_truth/src/sagemaker_ground_truth_component.py | ||||||
|  |  | ||||||
|  | @ -98,7 +98,7 @@ outputs: | ||||||
|     the training algorithm.} |     the training algorithm.} | ||||||
| implementation: | implementation: | ||||||
|   container: |   container: | ||||||
|     image: amazon/aws-sagemaker-kfp-components:1.1.0 |     image: amazon/aws-sagemaker-kfp-components:1.1.1 | ||||||
|     command: [python3] |     command: [python3] | ||||||
|     args: |     args: | ||||||
|     - hyperparameter_tuning/src/sagemaker_tuning_component.py |     - hyperparameter_tuning/src/sagemaker_tuning_component.py | ||||||
|  |  | ||||||
|  | @ -37,7 +37,7 @@ outputs: | ||||||
| - {name: model_name, description: The name of the model created by SageMaker.} | - {name: model_name, description: The name of the model created by SageMaker.} | ||||||
| implementation: | implementation: | ||||||
|   container: |   container: | ||||||
|     image: amazon/aws-sagemaker-kfp-components:1.1.0 |     image: amazon/aws-sagemaker-kfp-components:1.1.1 | ||||||
|     command: [python3] |     command: [python3] | ||||||
|     args: |     args: | ||||||
|     - model/src/sagemaker_model_component.py |     - model/src/sagemaker_model_component.py | ||||||
|  |  | ||||||
|  | @ -57,7 +57,7 @@ outputs: | ||||||
| - {name: output_artifacts, description: A dictionary containing the output S3 artifacts.} | - {name: output_artifacts, description: A dictionary containing the output S3 artifacts.} | ||||||
| implementation: | implementation: | ||||||
|   container: |   container: | ||||||
|     image: amazon/aws-sagemaker-kfp-components:1.1.0 |     image: amazon/aws-sagemaker-kfp-components:1.1.1 | ||||||
|     command: [python3] |     command: [python3] | ||||||
|     args: |     args: | ||||||
|     - process/src/sagemaker_process_component.py |     - process/src/sagemaker_process_component.py | ||||||
|  |  | ||||||
|  | @ -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): |     def _get_job_outputs(self): | ||||||
|         """Map the S3 outputs of a processing job to a dictionary object. |         """Map the S3 outputs of a processing job to a dictionary object. | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -76,7 +76,7 @@ outputs: | ||||||
|     the training algorithm.} |     the training algorithm.} | ||||||
| implementation: | implementation: | ||||||
|   container: |   container: | ||||||
|     image: amazon/aws-sagemaker-kfp-components:1.1.0 |     image: amazon/aws-sagemaker-kfp-components:1.1.1 | ||||||
|     command: [python3] |     command: [python3] | ||||||
|     args: |     args: | ||||||
|     - rlestimator/src/sagemaker_rlestimator_component.py |     - rlestimator/src/sagemaker_rlestimator_component.py | ||||||
|  |  | ||||||
|  | @ -53,7 +53,7 @@ outputs: | ||||||
| - {name: job_id, description: The simulation job id.} | - {name: job_id, description: The simulation job id.} | ||||||
| implementation: | implementation: | ||||||
|   container: |   container: | ||||||
|     image: amazon/aws-sagemaker-kfp-components:1.1.0 |     image: amazon/aws-sagemaker-kfp-components:1.1.1 | ||||||
|     command: [python3] |     command: [python3] | ||||||
|     args: |     args: | ||||||
|     - simulation_job/src/robomaker_simulation_job_component.py |     - simulation_job/src/robomaker_simulation_job_component.py | ||||||
|  |  | ||||||
|  | @ -24,7 +24,7 @@ outputs: | ||||||
| - {name: batch_job_id, description: The simulation job batch id.} | - {name: batch_job_id, description: The simulation job batch id.} | ||||||
| implementation: | implementation: | ||||||
|   container: |   container: | ||||||
|     image: amazon/aws-sagemaker-kfp-components:1.1.0 |     image: amazon/aws-sagemaker-kfp-components:1.1.1 | ||||||
|     command: [python3] |     command: [python3] | ||||||
|     args: |     args: | ||||||
|     - simulation_job_batch/src/robomaker_simulation_job_batch_component.py |     - simulation_job_batch/src/robomaker_simulation_job_batch_component.py | ||||||
|  |  | ||||||
|  | @ -39,6 +39,13 @@ class TransformComponentTestCase(unittest.TestCase): | ||||||
|                 "BatchTransform-generated", self.component._transform_job_name |                 "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): |     def test_create_transform_job(self): | ||||||
|         spec = SageMakerTransformSpec(self.REQUIRED_ARGS) |         spec = SageMakerTransformSpec(self.REQUIRED_ARGS) | ||||||
|         request = self.component._create_job_request(spec.inputs, spec.outputs) |         request = self.component._create_job_request(spec.inputs, spec.outputs) | ||||||
|  |  | ||||||
|  | @ -23,7 +23,6 @@ class ProcessComponentTestCase(unittest.TestCase): | ||||||
|             self.REQUIRED_ARGS + ["--job_name", "job-name"] |             self.REQUIRED_ARGS + ["--job_name", "job-name"] | ||||||
|         ) |         ) | ||||||
|         unnamed_spec = SageMakerProcessSpec(self.REQUIRED_ARGS) |         unnamed_spec = SageMakerProcessSpec(self.REQUIRED_ARGS) | ||||||
| 
 |  | ||||||
|         self.component.Do(named_spec) |         self.component.Do(named_spec) | ||||||
|         self.assertEqual("job-name", self.component._processing_job_name) |         self.assertEqual("job-name", self.component._processing_job_name) | ||||||
| 
 | 
 | ||||||
|  | @ -34,6 +33,13 @@ class ProcessComponentTestCase(unittest.TestCase): | ||||||
|             self.component.Do(unnamed_spec) |             self.component.Do(unnamed_spec) | ||||||
|             self.assertEqual("unique", self.component._processing_job_name) |             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): |     def test_create_process_job(self): | ||||||
|         spec = SageMakerProcessSpec(self.REQUIRED_ARGS) |         spec = SageMakerProcessSpec(self.REQUIRED_ARGS) | ||||||
|         request = self.component._create_job_request(spec.inputs, spec.outputs) |         request = self.component._create_job_request(spec.inputs, spec.outputs) | ||||||
|  |  | ||||||
|  | @ -36,6 +36,13 @@ class TrainingComponentTestCase(unittest.TestCase): | ||||||
|             self.component.Do(unnamed_spec) |             self.component.Do(unnamed_spec) | ||||||
|             self.assertEqual("unique", self.component._training_job_name) |             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): |     def test_create_training_job(self): | ||||||
|         spec = SageMakerTrainingSpec(self.REQUIRED_ARGS) |         spec = SageMakerTrainingSpec(self.REQUIRED_ARGS) | ||||||
|         request = self.component._create_job_request(spec.inputs, spec.outputs) |         request = self.component._create_job_request(spec.inputs, spec.outputs) | ||||||
|  |  | ||||||
|  | @ -72,7 +72,7 @@ outputs: | ||||||
|     the training algorithm.} |     the training algorithm.} | ||||||
| implementation: | implementation: | ||||||
|   container: |   container: | ||||||
|     image: amazon/aws-sagemaker-kfp-components:1.1.0 |     image: amazon/aws-sagemaker-kfp-components:1.1.1 | ||||||
|     command: [python3] |     command: [python3] | ||||||
|     args: |     args: | ||||||
|     - train/src/sagemaker_training_component.py |     - train/src/sagemaker_training_component.py | ||||||
|  |  | ||||||
|  | @ -22,7 +22,7 @@ outputs: | ||||||
| - {name: workteam_arn, description: The ARN of the workteam.} | - {name: workteam_arn, description: The ARN of the workteam.} | ||||||
| implementation: | implementation: | ||||||
|   container: |   container: | ||||||
|     image: amazon/aws-sagemaker-kfp-components:1.1.0 |     image: amazon/aws-sagemaker-kfp-components:1.1.1 | ||||||
|     command: [python3] |     command: [python3] | ||||||
|     args: |     args: | ||||||
|     - workteam/src/sagemaker_workteam_component.py |     - workteam/src/sagemaker_workteam_component.py | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue