Skip to content

Commit 98f2a02

Browse files
fix: make marketplace jobnames unique
1 parent 8a42456 commit 98f2a02

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

tests/integ/marketplace_utils.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
# ANY KIND, either express or implied. See the License for the specific
1212
# language governing permissions and limitations under the License.
1313
from __future__ import absolute_import
14-
import uuid
1514

1615
REGION_ACCOUNT_MAP = {
1716
"us-east-1": "865070037744",
@@ -35,7 +34,3 @@
3534
"cn-north-1": "295401494951",
3635
"cn-northwest-1": "304690803264",
3736
}
38-
39-
40-
def random_8_digit_alpha_numeric_gen():
41-
return str(uuid.uuid4().hex.upper()[0:8])

tests/integ/test_marketplace.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,10 @@
2424
from sagemaker import AlgorithmEstimator, ModelPackage
2525
from sagemaker.serializers import CSVSerializer
2626
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
2928
from tests.integ import DATA_DIR
3029
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
3231

3332

3433
# 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):
117116
instance_count=1,
118117
instance_type=cpu_instance_type,
119118
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"),
121120
)
122121

123122
train_input = mktplace.sagemaker_session.upload_data(
@@ -205,7 +204,7 @@ def test_marketplace_tuning_job(sagemaker_session, cpu_instance_type):
205204
instance_count=1,
206205
instance_type=cpu_instance_type,
207206
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"),
209208
)
210209

211210
train_input = mktplace.sagemaker_session.upload_data(
@@ -218,7 +217,7 @@ def test_marketplace_tuning_job(sagemaker_session, cpu_instance_type):
218217

219218
tuner = HyperparameterTuner(
220219
estimator=mktplace,
221-
base_tuning_job_name="byo" + random_8_digit_alpha_numeric_gen(),
220+
base_tuning_job_name=unique_name_from_base("byo"),
222221
objective_metric_name="validation:accuracy",
223222
hyperparameter_ranges=hyperparameter_ranges,
224223
max_jobs=2,
@@ -248,7 +247,7 @@ def test_marketplace_transform_job(sagemaker_session, cpu_instance_type):
248247
instance_count=1,
249248
instance_type=cpu_instance_type,
250249
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"),
252251
)
253252

254253
train_input = algo.sagemaker_session.upload_data(

0 commit comments

Comments
 (0)