24
24
from sagemaker import AlgorithmEstimator , ModelPackage
25
25
from sagemaker .serializers import CSVSerializer
26
26
from sagemaker .tuner import IntegerParameter , HyperparameterTuner
27
- from sagemaker .utils import sagemaker_timestamp
28
- from sagemaker .utils import _aws_partition
27
+ from sagemaker .utils import sagemaker_timestamp , _aws_partition , unique_name_from_base
29
28
from tests .integ import DATA_DIR
30
29
from tests .integ .timeout import timeout , timeout_and_delete_endpoint_by_name
31
- from tests .integ .marketplace_utils import REGION_ACCOUNT_MAP , random_8_digit_alpha_numeric_gen
30
+ from tests .integ .marketplace_utils import REGION_ACCOUNT_MAP
32
31
33
32
34
33
# All these tests require a manual 1 time subscription to the following Marketplace items:
@@ -117,7 +116,7 @@ def test_marketplace_attach(sagemaker_session, cpu_instance_type):
117
116
instance_count = 1 ,
118
117
instance_type = cpu_instance_type ,
119
118
sagemaker_session = sagemaker_session ,
120
- base_job_name = "test-marketplace" + random_8_digit_alpha_numeric_gen ( ),
119
+ base_job_name = unique_name_from_base ( "test-marketplace" ),
121
120
)
122
121
123
122
train_input = mktplace .sagemaker_session .upload_data (
@@ -205,7 +204,7 @@ def test_marketplace_tuning_job(sagemaker_session, cpu_instance_type):
205
204
instance_count = 1 ,
206
205
instance_type = cpu_instance_type ,
207
206
sagemaker_session = sagemaker_session ,
208
- base_job_name = "test-marketplace" + random_8_digit_alpha_numeric_gen ( ),
207
+ base_job_name = unique_name_from_base ( "test-marketplace" ),
209
208
)
210
209
211
210
train_input = mktplace .sagemaker_session .upload_data (
@@ -218,7 +217,7 @@ def test_marketplace_tuning_job(sagemaker_session, cpu_instance_type):
218
217
219
218
tuner = HyperparameterTuner (
220
219
estimator = mktplace ,
221
- base_tuning_job_name = "byo" + random_8_digit_alpha_numeric_gen ( ),
220
+ base_tuning_job_name = unique_name_from_base ( "byo" ),
222
221
objective_metric_name = "validation:accuracy" ,
223
222
hyperparameter_ranges = hyperparameter_ranges ,
224
223
max_jobs = 2 ,
@@ -248,7 +247,7 @@ def test_marketplace_transform_job(sagemaker_session, cpu_instance_type):
248
247
instance_count = 1 ,
249
248
instance_type = cpu_instance_type ,
250
249
sagemaker_session = sagemaker_session ,
251
- base_job_name = "test-marketplace" + random_8_digit_alpha_numeric_gen ( ),
250
+ base_job_name = unique_name_from_base ( "test-marketplace" ),
252
251
)
253
252
254
253
train_input = algo .sagemaker_session .upload_data (
0 commit comments