Repository: kubeflow/pipelines

Issue:
[AWS SageMaker] Region availability of pre and post task lambdas for GroundTruth
Hi,

Is there a reason that only a subset of regions are used in `algorithm_arn_map` in https://github.com/kubeflow/pipelines/blob/master/components/aws/sagemaker/common/_utils.py to access the AWS Pre human and Post human lambda functions? In the SageMaker API docs there are more available: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/sagemaker.html#SageMaker.Client.create_labeling_job.

I think it would be helpful to limit the use of these components as little as possible.


Discussion:
More than happy to submit a PR for this as well, it seems like a pretty simple fix - just add in the extra regions/ARN mappings from the SageMaker docs

Resolving patch:
diff --git a/components/aws/sagemaker/common/_utils.py b/components/aws/sagemaker/common/_utils.py
--- a/components/aws/sagemaker/common/_utils.py
+++ b/components/aws/sagemaker/common/_utils.py
@@ -697,9 +697,15 @@ def create_labeling_job_request(args):
     algorithm_arn_map = {'us-west-2': '081040173940',
               'us-east-1': '432418664414',
               'us-east-2': '266458841044',
+              'ca-central-1': '918755190332',
               'eu-west-1': '568282634449',
+              'eu-west-2': '487402164563',
+              'eu-central-1': '203001061592',
               'ap-northeast-1': '477331159723',
-              'ap-southeast-1': '454466003867'}
+              'ap-northeast-2': '845288260483',
+              'ap-south-1': '565803892007',
+              'ap-southeast-1': '377565633583',
+              'ap-southeast-2': '454466003867'}
 
     task_map = {'bounding box': 'BoundingBox',
               'image classification': 'ImageMultiClass',
@@ -727,7 +733,12 @@ def create_labeling_job_request(args):
     request['OutputConfig']['S3OutputPath'] = args['output_location']
     request['OutputConfig']['KmsKeyId'] = args['output_encryption_key']
     request['RoleArn'] = args['role']
-    request['LabelCategoryConfigS3Uri'] = args['label_category_config']
+    
+    ### Update or pop label category config s3 uri
+    if not args['label_category_config']:
+        request.pop('LabelCategoryConfigS3Uri')
+    else:
+        request['LabelCategoryConfigS3Uri'] = args['label_category_config']
 
     ### Update or pop stopping conditions
     if not args['max_human_labeled_objects'] and not args['max_percent_objects']:


Test patch:
diff --git a/components/aws/sagemaker/tests/unit_tests/tests/test_ground_truth.py b/components/aws/sagemaker/tests/unit_tests/tests/test_ground_truth.py
--- a/components/aws/sagemaker/tests/unit_tests/tests/test_ground_truth.py
+++ b/components/aws/sagemaker/tests/unit_tests/tests/test_ground_truth.py
@@ -73,7 +73,7 @@ def test_ground_truth(self):
                        'TaskTimeLimitInSeconds': 180,
                        'AnnotationConsolidationConfig': {'AnnotationConsolidationLambdaArn': ''}},
       InputConfig={'DataSource': {'S3DataSource': {'ManifestS3Uri': 's3://fake-bucket/manifest'}}},
-      LabelAttributeName='test_job', LabelCategoryConfigS3Uri='', LabelingJobName='test_job',
+      LabelAttributeName='test_job', LabelingJobName='test_job',
       OutputConfig={'S3OutputPath': 's3://fake-bucket/output', 'KmsKeyId': ''},
       RoleArn='arn:aws:iam::123456789012:user/Development/product_1234/*', Tags=[]
     )
@@ -159,7 +159,6 @@ def test_pass_most_args(self):
                                                 'DataAttributes': {'ContentClassifiers': ['FreeOfAdultContent', 'FreeOfPersonallyIdentifiableInformation']}},
                                 'OutputConfig': {'S3OutputPath': 's3://fake-bucket/output', 'KmsKeyId': ''},
                                 'RoleArn': 'arn:aws:iam::123456789012:user/Development/product_1234/*',
-                                'LabelCategoryConfigS3Uri': '',
                                 'StoppingConditions': {'MaxHumanLabeledObjectCount': 10, 'MaxPercentageOfInputDatasetLabeled': 50},
                                 'LabelingJobAlgorithmsConfig': {'LabelingJobAlgorithmSpecificationArn': 'arn:aws:sagemaker:us-west-2:027400017018:labeling-job-algorithm-specification/image-classification',
                                                                 'InitialActiveLearningModelArn': 'fake-model-arn',