airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <>
Subject [GitHub] troychen728 commented on a change in pull request #3767: [AIRFLOW-2524]Add SageMaker Batch Inference
Date Mon, 20 Aug 2018 17:49:29 GMT
troychen728 commented on a change in pull request #3767: [AIRFLOW-2524]Add SageMaker Batch

 File path: airflow/contrib/operators/
 @@ -0,0 +1,133 @@
+# -*- 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
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from airflow.contrib.hooks.sagemaker_hook import SageMakerHook
+from airflow.models import BaseOperator
+from airflow.utils.decorators import apply_defaults
+from airflow.exceptions import AirflowException
+class SageMakerCreateTransformJobOperator(BaseOperator):
+    """
+       Initiate a SageMaker transform
+       This operator returns The ARN of the model created in Amazon SageMaker
+       :param sagemaker_conn_id: The SageMaker connection ID to use.
+       :type sagemaker_conn_id: string
+       :param transform_job_config:
+       The configuration necessary to start a transform job (templated)
+       :type transform_job_config: dict
+       :param model_config:
+       The configuration necessary to create a model, the default is none
+       which means that user should provide a created model in transform_job_config
+       If given, will be used to create a model before creating transform job
+       :type model_config: dict
+       :param region_name: The AWS region_name
+       :type region_name: string
+       :param use_db_config: Whether or not to use db config
+       associated with sagemaker_conn_id.
+       If set to true, will automatically update the transform config
+       with what's in db, so the db config doesn't need to
+       included everything, but what's there does replace the ones
+       in the transform_job_config, so be careful
+       :type use_db_config: bool
+       :param wait_for_completion: if the program should keep running until job finishes
+       :type wait_for_completion: bool
+       :param check_interval: if wait is set to be true, this is the time interval
+       which the operator will check the status of the transform job
+       :type check_interval: int
+       :param max_ingestion_time: if wait is set to be true, the operator will fail
+       if the transform job hasn't finish within the max_ingestion_time
+       (Caution: be careful to set this parameters because transform can take very long)
+       :type max_ingestion_time: int
+       :param aws_conn_id: The AWS connection ID to use.
+       :type aws_conn_id: string
+       **Example**:
+           The following operator would start a transform job when executed
+            sagemaker_transform =
+               SageMakerCreateTransformJobOperator(
+                   task_id='sagemaker_transform',
+                   transform_job_config=config_transform,
+                   model_config=config_model,
+                   region_name='us-west-2'
+                   sagemaker_conn_id='sagemaker_customers_conn',
+                   use_db_config=True,
+                   aws_conn_id='aws_customers_conn'
+               )
+       """
+    template_fields = ['transform_job_config']
+    template_ext = ()
+    ui_color = '#ededed'
+    @apply_defaults
+    def __init__(self,
+                 transform_job_config=None,
+                 model_config=None,
+                 region_name=None,
+                 sagemaker_conn_id=None,
+                 use_db_config=False,
+                 wait_for_completion=False,
+                 check_interval=2,
 Review comment:
   Do you suggest to change the name, or add a documentation?

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:

With regards,
Apache Git Services

View raw message