[ 
https://issues.apache.org/jira/browse/AIRFLOW-2524?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16564264#comment-16564264
 ] 

ASF GitHub Bot commented on AIRFLOW-2524:
-----------------------------------------

Fokko commented on a change in pull request #3658: [AIRFLOW-2524] Add Amazon 
SageMaker Training
URL: https://github.com/apache/incubator-airflow/pull/3658#discussion_r206655197
 
 

 ##########
 File path: tests/contrib/hooks/test_sagemaker_hook.py
 ##########
 @@ -0,0 +1,341 @@
+# -*- coding: utf-8 -*-
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+
+import json
+import unittest
+import copy
+try:
+    from unittest import mock
+except ImportError:
+    try:
+        import mock
+    except ImportError:
+        mock = None
+
+from airflow import configuration
+from airflow import models
+from airflow.utils import db
+from airflow.contrib.hooks.sagemaker_hook import SageMakerHook
+from airflow.hooks.S3_hook import S3Hook
+from airflow.exceptions import AirflowException
+
+
+role = 'test-role'
+
+bucket = 'test-bucket'
+
+key = 'test/data'
+data_url = 's3://{}/{}'.format(bucket, key)
+
+job_name = 'test-job-name'
+
+image = 'test-image'
+
+test_arn_return = {'TrainingJobArn': 'testarn'}
+
+test_list_training_job_return = {
+    'TrainingJobSummaries': [
+        {
+            'TrainingJobName': job_name,
+            'TrainingJobStatus': 'InProgress'
+        },
+    ],
+    'NextToken': 'test-token'
+}
+
+test_list_tuning_job_return = {
+    'TrainingJobSummaries': [
+        {
+            'TrainingJobName': job_name,
+            'TrainingJobArn': 'testarn',
+            'TunedHyperParameters': {
+                'k': '3'
+            },
+            'TrainingJobStatus': 'InProgress'
+        },
+    ],
+    'NextToken': 'test-token'
+}
+
+output_url = 's3://{}/test/output'.format(bucket)
+create_training_params = \
+    {
+        'AlgorithmSpecification': {
+            'TrainingImage': image,
+            'TrainingInputMode': 'File'
+        },
+        'RoleArn': role,
+        'OutputDataConfig': {
+            'S3OutputPath': output_url
+        },
+        'ResourceConfig': {
+            'InstanceCount': 2,
+            'InstanceType': 'ml.c4.8xlarge',
+            'VolumeSizeInGB': 50
+        },
+        'TrainingJobName': job_name,
+        'HyperParameters': {
+            'k': '10',
+            'feature_dim': '784',
+            'mini_batch_size': '500',
+            'force_dense': 'True'
+        },
+        'StoppingCondition': {
+            'MaxRuntimeInSeconds': 60 * 60
+        },
+        'InputDataConfig': [
+            {
+                'ChannelName': 'train',
+                'DataSource': {
+                    'S3DataSource': {
+                        'S3DataType': 'S3Prefix',
+                        'S3Uri': data_url,
+                        'S3DataDistributionType': 'FullyReplicated'
+                    }
+                },
+                'CompressionType': 'None',
+                'RecordWrapperType': 'None'
+            }
+        ]
+    }
+
+create_tuning_params = {'HyperParameterTuningJobName': job_name,
+                        'HyperParameterTuningJobConfig': {
+                            'Strategy': 'Bayesian',
+                            'HyperParameterTuningJobObjective': {
+                                'Type': 'Maximize',
+                                'MetricName': 'test_metric'
+                            },
+                            'ResourceLimits': {
+                                'MaxNumberOfTrainingJobs': 123,
+                                'MaxParallelTrainingJobs': 123
+                            },
+                            'ParameterRanges': {
+                                'IntegerParameterRanges': [
+                                    {
+                                        'Name': 'k',
+                                        'MinValue': '2',
+                                        'MaxValue': '10'
+                                    },
+                                ]
+                            }
+                        },
+                        'TrainingJobDefinition': {
+                            'StaticHyperParameters':
+                                create_training_params['HyperParameters'],
+                            'AlgorithmSpecification':
+                                
create_training_params['AlgorithmSpecification'],
+                            'RoleArn': 'string',
+                            'InputDataConfig':
 
 Review comment:
   Please do some autoformatting here.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Airflow integration with AWS Sagemaker
> --------------------------------------
>
>                 Key: AIRFLOW-2524
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-2524
>             Project: Apache Airflow
>          Issue Type: Improvement
>          Components: aws, contrib
>            Reporter: Rajeev Srinivasan
>            Assignee: Yang Yu
>            Priority: Major
>              Labels: AWS
>
> Would it be possible to orchestrate an end to end  AWS  Sagemaker job using 
> Airflow.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to