|
| 1 | +# Copyright 2019-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"). You |
| 4 | +# may not use this file except in compliance with the License. A copy of |
| 5 | +# the License is located at |
| 6 | +# |
| 7 | +# http://aws.amazon.com/apache2.0/ |
| 8 | +# |
| 9 | +# or in the "license" file accompanying this file. This file is |
| 10 | +# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF |
| 11 | +# ANY KIND, either express or implied. See the License for the specific |
| 12 | +# language governing permissions and limitations under the License. |
| 13 | +"""This module contains code related to MXNet Processors which are used for Processing jobs. |
| 14 | +
|
| 15 | +These jobs let customers perform data pre-processing, post-processing, feature engineering, |
| 16 | +data validation, and model evaluation and interpretation on SageMaker. |
| 17 | +""" |
| 18 | +from __future__ import absolute_import |
| 19 | + |
| 20 | +from sagemaker.mxnet.estimator import MXNet |
| 21 | +from sagemaker.processing import FrameworkProcessor |
| 22 | + |
| 23 | + |
| 24 | +class MXNetProcessor(FrameworkProcessor): |
| 25 | + """Handles Amazon SageMaker processing tasks for jobs using MXNet containers.""" |
| 26 | + |
| 27 | + estimator_cls = MXNet |
| 28 | + |
| 29 | + def __init__( |
| 30 | + self, |
| 31 | + framework_version, # New arg |
| 32 | + s3_prefix, # New arg |
| 33 | + role, |
| 34 | + instance_count, |
| 35 | + instance_type, |
| 36 | + py_version="py3", # New kwarg |
| 37 | + image_uri=None, |
| 38 | + volume_size_in_gb=30, |
| 39 | + volume_kms_key=None, |
| 40 | + output_kms_key=None, |
| 41 | + max_runtime_in_seconds=None, |
| 42 | + base_job_name=None, |
| 43 | + sagemaker_session=None, |
| 44 | + env=None, |
| 45 | + tags=None, |
| 46 | + network_config=None, |
| 47 | + ): |
| 48 | + """This processor executes a Python script in a managed MXNet execution environment. |
| 49 | +
|
| 50 | + Unless ``image_uri`` is specified, the MXNet environment is an |
| 51 | + Amazon-built Docker container that executes functions defined in the supplied |
| 52 | + ``entry_point`` Python script. |
| 53 | +
|
| 54 | + The arguments have the exact same meaning as in ``FrameworkProcessor``. |
| 55 | +
|
| 56 | + .. tip:: |
| 57 | +
|
| 58 | + You can find additional parameters for initializing this class at |
| 59 | + :class:`~sagemaker.processing.FrameworkProcessor`. |
| 60 | + """ |
| 61 | + super().__init__( |
| 62 | + self.estimator_cls, |
| 63 | + framework_version, |
| 64 | + s3_prefix, |
| 65 | + role, |
| 66 | + instance_count, |
| 67 | + instance_type, |
| 68 | + py_version, |
| 69 | + image_uri, |
| 70 | + volume_size_in_gb, |
| 71 | + volume_kms_key, |
| 72 | + output_kms_key, |
| 73 | + max_runtime_in_seconds, |
| 74 | + base_job_name, |
| 75 | + sagemaker_session, |
| 76 | + env, |
| 77 | + tags, |
| 78 | + network_config, |
| 79 | + ) |
0 commit comments