1- # Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1+ # Copyright 2017-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
22#
33# Licensed under the Apache License, Version 2.0 (the "License"). You
44# may not use this file except in compliance with the License. A copy of
1919from six .moves .urllib .parse import urlparse
2020
2121from sagemaker_tensorflow_container .training import SAGEMAKER_PARAMETER_SERVER_ENABLED
22+ from utils import unique_name_from_base
2223
2324
2425def test_mnist (sagemaker_session , ecr_image , instance_type , framework_version ):
@@ -31,12 +32,11 @@ def test_mnist(sagemaker_session, ecr_image, instance_type, framework_version):
3132 sagemaker_session = sagemaker_session ,
3233 image_name = ecr_image ,
3334 framework_version = framework_version ,
34- py_version = 'py3' ,
35- base_job_name = 'test-sagemaker-mnist' )
35+ script_mode = True )
3636 inputs = estimator .sagemaker_session .upload_data (
3737 path = os .path .join (resource_path , 'mnist' , 'data' ),
3838 key_prefix = 'scriptmode/mnist' )
39- estimator .fit (inputs )
39+ estimator .fit (inputs , job_name = unique_name_from_base ( 'test-sagemaker-mnist' ) )
4040 _assert_s3_file_exists (sagemaker_session .boto_region_name , estimator .model_data )
4141
4242
@@ -50,12 +50,11 @@ def test_distributed_mnist_no_ps(sagemaker_session, ecr_image, instance_type, fr
5050 sagemaker_session = sagemaker_session ,
5151 image_name = ecr_image ,
5252 framework_version = framework_version ,
53- py_version = 'py3' ,
54- base_job_name = 'test-tf-sm-distributed-mnist' )
53+ script_mode = True )
5554 inputs = estimator .sagemaker_session .upload_data (
5655 path = os .path .join (resource_path , 'mnist' , 'data' ),
5756 key_prefix = 'scriptmode/mnist' )
58- estimator .fit (inputs )
57+ estimator .fit (inputs , job_name = unique_name_from_base ( 'test-tf-sm-distributed-mnist' ) )
5958 _assert_s3_file_exists (sagemaker_session .boto_region_name , estimator .model_data )
6059
6160
@@ -70,12 +69,11 @@ def test_distributed_mnist_ps(sagemaker_session, ecr_image, instance_type, frame
7069 sagemaker_session = sagemaker_session ,
7170 image_name = ecr_image ,
7271 framework_version = framework_version ,
73- py_version = 'py3' ,
74- base_job_name = 'test-tf-sm-distributed-mnist' )
72+ script_mode = True )
7573 inputs = estimator .sagemaker_session .upload_data (
7674 path = os .path .join (resource_path , 'mnist' , 'data-distributed' ),
7775 key_prefix = 'scriptmode/mnist-distributed' )
78- estimator .fit (inputs )
76+ estimator .fit (inputs , job_name = unique_name_from_base ( 'test-tf-sm-distributed-mnist' ) )
7977 _assert_checkpoint_exists (sagemaker_session .boto_region_name , estimator .model_dir , 0 )
8078 _assert_s3_file_exists (sagemaker_session .boto_region_name , estimator .model_data )
8179
@@ -104,9 +102,9 @@ def test_s3_plugin(sagemaker_session, ecr_image, instance_type, region, framewor
104102 sagemaker_session = sagemaker_session ,
105103 image_name = ecr_image ,
106104 framework_version = framework_version ,
107- py_version = 'py3' ,
108- base_job_name = 'test-tf-sm-s3- mnist')
109- estimator . fit ( 's3://sagemaker-sample-data-{}/tensorflow/ mnist'. format ( region ))
105+ script_mode = True )
106+ estimator . fit ( 's3://sagemaker-sample-data-{}/tensorflow/ mnist'. format ( region ),
107+ job_name = unique_name_from_base ( 'test-tf-sm-s3- mnist' ))
110108 _assert_s3_file_exists (region , estimator .model_data )
111109 _assert_checkpoint_exists (region , estimator .model_dir , 200 )
112110
0 commit comments