Skip to content

Commit

Permalink
Use sagemaker_timestamp when creating endpoint names in integration t…
Browse files Browse the repository at this point in the history
…ests. (#81)
  • Loading branch information
lukmis committed Feb 21, 2018
1 parent 06249d4 commit 1380a26
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions tests/integ/test_linear_learner.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import sagemaker
from sagemaker.amazon.linear_learner import LinearLearner, LinearLearnerModel
from sagemaker.utils import name_from_base
from sagemaker.utils import name_from_base, sagemaker_timestamp

from tests.integ import DATA_DIR, REGION
from tests.integ.timeout import timeout, timeout_and_delete_endpoint_by_name
Expand Down Expand Up @@ -90,7 +90,7 @@ def test_linear_learner():
def test_async_linear_learner():

training_job_name = ""
endpoint_name = 'test-linear-learner-async-{}'.format(int(time.time()))
endpoint_name = 'test-linear-learner-async-{}'.format(sagemaker_timestamp())
sagemaker_session = sagemaker.Session(boto_session=boto3.Session(region_name=REGION))

with timeout(minutes=5):
Expand Down
7 changes: 4 additions & 3 deletions tests/integ/test_mxnet_train.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from sagemaker import Session
from sagemaker.mxnet.estimator import MXNet
from sagemaker.mxnet.model import MXNetModel
from sagemaker.utils import sagemaker_timestamp

from tests.integ import DATA_DIR, REGION
from tests.integ.timeout import timeout, timeout_and_delete_endpoint_by_name
Expand Down Expand Up @@ -49,7 +50,7 @@ def mxnet_training_job(sagemaker_session):


def test_attach_deploy(mxnet_training_job, sagemaker_session):
endpoint_name = 'test-mxnet-attach-deploy-{}'.format(int(time.time()))
endpoint_name = 'test-mxnet-attach-deploy-{}'.format(sagemaker_timestamp())

with timeout_and_delete_endpoint_by_name(endpoint_name, sagemaker_session, minutes=20):
estimator = MXNet.attach(mxnet_training_job, sagemaker_session=sagemaker_session)
Expand All @@ -61,7 +62,7 @@ def test_attach_deploy(mxnet_training_job, sagemaker_session):
def test_async_fit(sagemaker_session):

training_job_name = ""
endpoint_name = 'test-mxnet-attach-deploy-{}'.format(int(time.time()))
endpoint_name = 'test-mxnet-attach-deploy-{}'.format(sagemaker_timestamp())

with timeout(minutes=5):
script_path = os.path.join(DATA_DIR, 'mxnet_mnist', 'mnist.py')
Expand Down Expand Up @@ -91,7 +92,7 @@ def test_async_fit(sagemaker_session):


def test_deploy_model(mxnet_training_job, sagemaker_session):
endpoint_name = 'test-mxnet-deploy-model-{}'.format(int(time.time()))
endpoint_name = 'test-mxnet-deploy-model-{}'.format(sagemaker_timestamp())

with timeout_and_delete_endpoint_by_name(endpoint_name, sagemaker_session, minutes=20):
desc = sagemaker_session.sagemaker_client.describe_training_job(TrainingJobName=mxnet_training_job)
Expand Down

0 comments on commit 1380a26

Please sign in to comment.