12
12
# language governing permissions and limitations under the License.
13
13
from __future__ import absolute_import
14
14
15
- import numpy
16
15
import os
16
+
17
+ import numpy
17
18
import pytest
19
+
18
20
from sagemaker .mxnet .estimator import MXNet
19
21
from sagemaker .mxnet .model import MXNetModel
20
- from sagemaker .utils import sagemaker_timestamp
22
+ from sagemaker .utils import unique_name_from_base
21
23
from tests .integ import DATA_DIR , PYTHON_VERSION , TRAINING_DEFAULT_TIMEOUT_MINUTES
22
24
from tests .integ .timeout import timeout , timeout_and_delete_endpoint_by_name
23
- import time
25
+
26
+ NEO_MXNET_VERSION = "1.4.1" # Neo doesn't support MXNet 1.6 yet.
24
27
25
28
26
29
@pytest .fixture (scope = "module" )
27
- def mxnet_training_job (sagemaker_session , mxnet_full_version , cpu_instance_type ):
30
+ def mxnet_training_job (sagemaker_session , cpu_instance_type ):
28
31
with timeout (minutes = TRAINING_DEFAULT_TIMEOUT_MINUTES ):
29
32
script_path = os .path .join (DATA_DIR , "mxnet_mnist" , "mnist_neo.py" )
30
33
data_path = os .path .join (DATA_DIR , "mxnet_mnist" )
31
34
32
35
mx = MXNet (
33
36
entry_point = script_path ,
34
37
role = "SageMakerRole" ,
35
- framework_version = mxnet_full_version ,
38
+ framework_version = NEO_MXNET_VERSION ,
36
39
py_version = PYTHON_VERSION ,
37
40
train_instance_count = 1 ,
38
41
train_instance_type = cpu_instance_type ,
@@ -52,13 +55,10 @@ def mxnet_training_job(sagemaker_session, mxnet_full_version, cpu_instance_type)
52
55
53
56
@pytest .mark .canary_quick
54
57
@pytest .mark .regional_testing
55
- @pytest .mark .skip (
56
- reason = "This should be enabled along with the Boto SDK release for Neo API changes"
57
- )
58
58
def test_attach_deploy (
59
59
mxnet_training_job , sagemaker_session , cpu_instance_type , cpu_instance_family
60
60
):
61
- endpoint_name = "test-mxnet -attach-deploy-{}" . format ( sagemaker_timestamp () )
61
+ endpoint_name = unique_name_from_base ( "test-neo -attach-deploy" )
62
62
63
63
with timeout_and_delete_endpoint_by_name (endpoint_name , sagemaker_session ):
64
64
estimator = MXNet .attach (mxnet_training_job , sagemaker_session = sagemaker_session )
@@ -77,13 +77,10 @@ def test_attach_deploy(
77
77
predictor .predict (data )
78
78
79
79
80
- @pytest .mark .skip (
81
- reason = "This should be enabled along with the Boto SDK release for Neo API changes"
82
- )
83
80
def test_deploy_model (
84
81
mxnet_training_job , sagemaker_session , cpu_instance_type , cpu_instance_family
85
82
):
86
- endpoint_name = "test-mxnet -deploy-model-{}" . format ( sagemaker_timestamp () )
83
+ endpoint_name = unique_name_from_base ( "test-neo -deploy-model" )
87
84
88
85
with timeout_and_delete_endpoint_by_name (endpoint_name , sagemaker_session ):
89
86
desc = sagemaker_session .sagemaker_client .describe_training_job (
@@ -97,14 +94,15 @@ def test_deploy_model(
97
94
role ,
98
95
entry_point = script_path ,
99
96
py_version = PYTHON_VERSION ,
97
+ framework_version = NEO_MXNET_VERSION ,
100
98
sagemaker_session = sagemaker_session ,
101
99
)
102
100
103
101
model .compile (
104
102
target_instance_family = cpu_instance_family ,
105
103
input_shape = {"data" : [1 , 1 , 28 , 28 ]},
106
104
role = role ,
107
- job_name = "test-deploy-model-compilation-job-{}" . format ( int ( time . time ()) ),
105
+ job_name = unique_name_from_base ( "test-deploy-model-compilation-job" ),
108
106
output_path = "/" .join (model_data .split ("/" )[:- 1 ]),
109
107
)
110
108
predictor = model .deploy (1 , cpu_instance_type , endpoint_name = endpoint_name )
0 commit comments