AWS sagemaker documentation change
Summary
Updated documentation to replace 'ScriptProcessor' with 'ProcessingJob' class, updated import statements and execution role retrieval
Security assessment
Changes involve API updates from ScriptProcessor to ProcessingJob class and improved execution role handling. No security vulnerabilities, incidents, or weaknesses are mentioned. Updates focus on code modernization without security implications.
Diff
diff --git a/sagemaker/latest/dg/geospatial-custom-operations-procedure.md b/sagemaker/latest/dg/geospatial-custom-operations-procedure.md index 3f18a3493..e4a7bc2e8 100644 --- a//sagemaker/latest/dg/geospatial-custom-operations-procedure.md +++ b//sagemaker/latest/dg/geospatial-custom-operations-procedure.md @@ -7 +7 @@ -Query a raster data collectionCreate an input manifest fileWrite a processing job scriptCreate a ScriptProcessor instanceVisualize results +Query a raster data collectionCreate an input manifest fileWrite a processing job scriptCreate a ProcessingJob instanceVisualize results @@ -9 +9 @@ Query a raster data collectionCreate an input manifest fileWrite a processing jo -# Using `ScriptProcessor` to calculate the Normalized Difference Vegetation Index (NDVI) using Sentinel-2 satellite data +# Using `ProcessingJob` to calculate the Normalized Difference Vegetation Index (NDVI) using Sentinel-2 satellite data @@ -11 +11 @@ Query a raster data collectionCreate an input manifest fileWrite a processing jo -The following code samples show you how to calculate the normalized difference vegetation index of a specific geographical area using the purpose-built geospatial image within a Studio Classic notebook and run a large-scale workload with Amazon SageMaker Processing using [`ScriptProcessor`](https://sagemaker.readthedocs.io/en/stable/api/training/processing.html#sagemaker.processing.ScriptProcessor) from the SageMaker AI Python SDK. +The following code samples show you how to calculate the normalized difference vegetation index of a specific geographical area using the purpose-built geospatial image within a Studio Classic notebook and run a large-scale workload with Amazon SageMaker Processing using [`ProcessingJob`](https://sagemaker.readthedocs.io/en/stable/api/sagemaker_core.html) from the SageMaker AI Python SDK. @@ -23 +23 @@ You can follow along with this demo in your own notebook instance by copying and - 4. Create a ScriptProcessor instance and start the Amazon SageMaker Processing job. + 4. Create a ProcessingJob instance and start the Amazon SageMaker Processing job. @@ -155 +155,2 @@ Use SDK for Python (Boto3) to get the default bucket and the ARN of the executio - sm_session = sagemaker.session.Session() + from sagemaker.core.helper.session_helper import Session, get_execution_role + sm_session = Session() @@ -158 +159 @@ Use SDK for Python (Boto3) to get the default bucket and the ARN of the executio - execution_role_arn = sagemaker.get_execution_role() + execution_role_arn = get_execution_role() @@ -233 +234 @@ Amazon SageMaker Studio Classic supports the use of the `%%writefile` cell magic - * With Amazon SageMaker Processing, a script that a processing job runs can upload your processed data directly to Amazon S3. To do so, make sure that the execution role associated with your `ScriptProcessor` instance has the necessary requirements to access the S3 bucket. You can also specify an outputs parameter when you run your processing job. To learn more, see the [`.run()` API operation ](https://sagemaker.readthedocs.io/en/stable/api/training/processing.html#sagemaker.processing.ScriptProcessor.run) in the _Amazon SageMaker Python SDK_. In this code example, the results of the data processing are uploaded directly to Amazon S3. + * With Amazon SageMaker Processing, a script that a processing job runs can upload your processed data directly to Amazon S3. To do so, make sure that the execution role associated with your `ProcessingJob` instance has the necessary requirements to access the S3 bucket. You can also specify an outputs parameter when you run your processing job. To learn more, see the [`.run()` API operation ](https://sagemaker.readthedocs.io/en/stable/api/sagemaker_core.html) in the _Amazon SageMaker Python SDK_. In this code example, the results of the data processing are uploaded directly to Amazon S3. @@ -292 +293 @@ You now have a script that can calculate the NDVI. Next, you can create an insta -## Creating an instance of the `ScriptProcessor` class +## Creating an instance of the `ProcessingJob` class @@ -294 +295 @@ You now have a script that can calculate the NDVI. Next, you can create an insta -This demo uses the [ScriptProcessor](https://sagemaker.readthedocs.io/en/stable/api/training/processing.html#sagemaker.processing.ScriptProcessor) class that is available via the Amazon SageMaker Python SDK. First, you need to create an instance of the class, and then you can start your Processing job by using the `.run()` method. +This demo uses the [ScriptProcessor](https://sagemaker.readthedocs.io/en/stable/api/sagemaker_core.html) class that is available via the Amazon SageMaker Python SDK. First, you need to create an instance of the class, and then you can start your Processing job by using the `.run()` method. @@ -297 +298 @@ This demo uses the [ScriptProcessor](https://sagemaker.readthedocs.io/en/stable/ - from sagemaker.processing import ScriptProcessor, ProcessingInput, ProcessingOutput + from sagemaker.core.processing import Processor, ProcessingInput, ProcessingOutput @@ -301 +302 @@ This demo uses the [ScriptProcessor](https://sagemaker.readthedocs.io/en/stable/ - processor = ScriptProcessor( + processor = Processor( @@ -312 +313 @@ This demo uses the [ScriptProcessor](https://sagemaker.readthedocs.io/en/stable/ -When you start your Processing job, you need to specify a [`ProcessingInput`](https://sagemaker.readthedocs.io/en/stable/api/training/processing.html#sagemaker.processing.ProcessingInput) object. In that object, you specify the following: +When you start your Processing job, you need to specify a [`ProcessingInput`](https://sagemaker.readthedocs.io/en/stable/api/sagemaker_core.html) object. In that object, you specify the following: @@ -345 +346 @@ When you start your Processing job, you need to specify a [`ProcessingInput`](ht -The following code example uses the [`.describe()` method](https://sagemaker.readthedocs.io/en/stable/api/training/processing.html#sagemaker.processing.ProcessingJob.describe) to get details of your Processing job. +The following code example uses the [`.describe()` method](https://sagemaker.readthedocs.io/en/stable/api/sagemaker_core.html) to get details of your Processing job. @@ -382 +383 @@ The output of the preceding code example is a satellite image with the NDVI valu -This completes the demo of using `ScriptProcessor`. +This completes the demo of using `ProcessingJob`. @@ -390 +391 @@ To use the Amazon Web Services Documentation, Javascript must be enabled. Please -Overview: ScriptProcessor API +Overview: ProcessingJob API