Skip to content

Commit

Permalink
SageMaker edits
Browse files Browse the repository at this point in the history
Edits for descriptions, comment strings.
  • Loading branch information
beckandros committed Aug 20, 2020
1 parent 1f8cc88 commit f0cee45
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 21 deletions.
21 changes: 10 additions & 11 deletions javav2/example_code/sagemaker/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ For systems with Bash support, once you set the **CLASSPATH**, you can run a par

## Testing the Amazon SageMaker Java files

You can test the Java code examples for Amazon SageMaker by running a test file named **SageMakerServiceIntegrationTest**. This file uses JUnit 5 to run the JUnit tests and is located in the **src/test/java** folder. For more information, see [https://junit.org/junit5/](https://junit.org/junit5/).
You can test the Java code examples for SageMaker by running a test file named **SageMakerServiceIntegrationTest**. This file uses JUnit 5 to run the JUnit tests and is located in the **src/test/java** folder. For more information, see [https://junit.org/junit5/](https://junit.org/junit5/).

You can run the JUnit tests from a Java IDE, such as IntelliJ, or from the command line by using Maven. As each test runs, you can view messages that inform you if the various tests succeed or fail. For example, the following message informs you that Test 3 passed.

Expand All @@ -32,24 +32,24 @@ You can run the JUnit tests from a Java IDE, such as IntelliJ, or from the comma
**WARNING**: _Running these JUnit tests manipulates real Amazon resources and may incur charges on your account._

### Properties file
Before running the Amazon SageMaker JUnit tests, you must define values in the **config.properties** file located in the **resources** folder. This file contains values that are required to run the JUnit tests. For example, you define a model name used in the tests. If you do not define all values, the JUnit tests fail.
Before running the SageMaker JUnit tests, you must define values in the **config.properties** file located in the **resources** folder. This file contains values that are required to run the JUnit tests. For example, you define a model name used in the tests. If you do not define all values, the JUnit tests fail.

Define these values to successfully run the JUnit tests:

- **image** - The registry path of the Docker image that contains the training algorithm.
- **modelDataUrl** - The S3 path where the model artifacts, which result from model training, are stored.
- **executionRoleArn** - The Amazon Resource Name (ARN) of the IAM role that Amazon SageMaker uses.
- **modelDataUrl** - The Amazon S3 path where the model artifacts, which result from model training, are stored.
- **executionRoleArn** - The Amazon Resource Name (ARN) of the IAM role that SageMaker uses.
- **modelName** - The model name used in various tests.
- **s3UriData** - The S3 path where the model data is stored and used in the **CreateTrainingJob** test.
- **s3Uri** - The S3 path where you want Amazon SageMaker to store checkpoints.
- **s3UriData** - The Amazon S3 path where the model data is stored and used in the **CreateTrainingJob** test.
- **s3Uri** - The Amazon S3 path where you want SageMaker to store checkpoints.
- **trainingJobName** - The name of the training job.
- **roleArn** - The Amazon Resource Name (ARN) of the IAM role that Amazon SageMaker uses.
- **s3OutputPath** - The output path located in a S3 bucket (i.e., s3://trainbucket/sagemaker).
- **roleArn** - The ARN of the IAM role that SageMaker uses.
- **s3OutputPath** - The output path located in an Amazon S3 bucket (i.e., s3://trainbucket/sagemaker).
- **channelName** - The channel name.
- **trainingImage** - The training image.


**Note**: To setup the model data and other requirements needed for the unit tests, follow [Build, Train, and Deploy a Machine Learning Model](https://aws.amazon.com/getting-started/hands-on/build-train-deploy-machine-learning-model-sagemaker/).
**Note**: To set up the model data and other requirements needed for the unit tests, follow [Build, train, and deploy a machine learning model](https://aws.amazon.com/getting-started/hands-on/build-train-deploy-machine-learning-model-sagemaker/).

### Command line
To run the JUnit tests from the command line, you can use the following command.
Expand Down Expand Up @@ -88,6 +88,5 @@ If you do not define the correct values in the properties file, your JUnit tests
[INFO] Total time: 19.038 s
[INFO] Finished at: 2020-02-10T14:41:51-05:00
[INFO] ---------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.1:test (default-test) on project AmazonRedshiftServiceIntegrationTest: There are test failures.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.1:test (default-test) on project SageMakerServiceIntegrationTest: There are test failures.
[ERROR];

Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public static void main(String[] args) {
"Usage:\n" +
" CreateModel <dataUrl> <image> <modelName><executionRoleArn>\n\n" +
"Where:\n" +
" dataUrl - The S3 path where the model artifacts, which result from model training, are stored.\n\n" +
" image - The Amazon EC2 Container Registry (Amazon ECR) path where inference code is stored. (i.e., 000555047983.dkr.ecr.us-west-2.amazonaws.com/train)\n\n" +
" dataUrl - The Amazon S3 path where the model artifacts, which result from model training, are stored.\n\n" +
" image - The Amazon EC2 Container Registry (Amazon ECR) path where inference code is stored (i.e., 000555047983.dkr.ecr.us-west-2.amazonaws.com/train).\n\n" +
" modelName - The name of the model.\n\n" +
" executionRoleArn - The Amazon Resource Name (ARN) of the IAM role that Amazon SageMaker can assume to access model artifacts (i.e., arn:aws:iam::000555047983:role/service-role/AmazonSageMaker-ExecutionRole-20200627T12xxxx).\n\n";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
//snippet-end:[sagemaker.java2.train_job.import]

/**
* To setup the model data and other requirements to make this Java V2 example work, follow this AWS tutorial prior to running this Java code example.
* https://aws.amazon.com/getting-started/hands-on/build-train-deploy-machine-learning-model-sagemaker/
* To set up the model data and other requirements to make this AWS SDK for Java V2 example work, follow this AWS tutorial before running this Java code example:
* https://aws.amazon.com/getting-started/hands-on/build-train-deploy-machine-learning-model-sagemaker/.
*/

public class CreateTrainingJob {
Expand All @@ -58,13 +58,13 @@ public static void main(String[] args) {
"Usage:\n" +
" CreateTrainingJob <s3UriData><s3Uri><trainingJobName><roleArn><s3OutputPath><channelName><trainingImage>\n\n" +
"Where:\n" +
" s3UriData - The location where the training data is located (ie, s3://trainbucket/train.csv).\n\n" +
" s3Uri - The S3 path where you want Amazon SageMaker to store checkpoints (ie, s3://trainbucket).\n\n" +
" s3UriData - The location of the training data (i.e, s3://trainbucket/train.csv).\n\n" +
" s3Uri - The Amazon S3 path where you want Amazon SageMaker to store checkpoints (i.e., s3://trainbucket).\n\n" +
" trainingJobName - The name of the training job. \n\n" +
" roleArn - The Amazon Resource Name (ARN) of the IAM role that Amazon SageMaker uses.\n\n" +
" s3OutputPath - The output path located in a S3 bucket (i.e., s3://trainbucket/sagemaker).\n\n" +
" roleArn - The Amazon Resource Name (ARN) of the IAM role that SageMaker uses.\n\n" +
" s3OutputPath - The output path located in an Amazon S3 bucket (i.e., s3://trainbucket/sagemaker).\n\n" +
" channelName - The channel name (i.e., s3://trainbucket/sagemaker).\n\n" +
" trainingImage - The channel name (i.e., 000007028032.bbb.zzz.us-west-2.amazonaws.com/xgboost:latest.\n\n";
" trainingImage - The training image (i.e., 000007028032.bbb.zzz.us-west-2.amazonaws.com/xgboost:latest.\n\n";

if (args.length < 7) {
System.out.println(USAGE);
Expand Down Expand Up @@ -115,7 +115,7 @@ public static void trainJob(SageMakerClient sageMakerClient,
.dataSource(dataSource)
.build();

// Build a LIST of CHannels
// Build a list of channels
List<Channel> myChannel = new ArrayList();
myChannel.add(channel);

Expand Down

0 comments on commit f0cee45

Please sign in to comment.