Skip to content

change: waiting for training tags to propagate in the test #955

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 29, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions tests/integ/test_tf_script_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,14 @@ def test_mnist_async(sagemaker_session):
training_job_name = estimator.latest_training_job.name
time.sleep(20)
endpoint_name = training_job_name
model_name = "model-name-1"
_assert_training_job_tags_match(
sagemaker_session.sagemaker_client, estimator.latest_training_job.name, TAGS
)
with tests.integ.timeout.timeout_and_delete_endpoint_by_name(endpoint_name, sagemaker_session):
estimator = TensorFlow.attach(
training_job_name=training_job_name, sagemaker_session=sagemaker_session
)
model_name = "model-mnist-async"
predictor = estimator.deploy(
initial_instance_count=1,
instance_type="ml.c4.xlarge",
Expand Down Expand Up @@ -215,14 +215,14 @@ def _assert_s3_files_exist(s3_url, files):
raise ValueError("File {} is not found under {}".format(f, s3_url))


def _assert_tags_match(sagemaker_client, resource_arn, tags, retries=1):
def _assert_tags_match(sagemaker_client, resource_arn, tags, retries=15):
actual_tags = None
for _ in range(retries):
actual_tags = sagemaker_client.list_tags(ResourceArn=resource_arn)["Tags"]
if actual_tags:
break
else:
# endpoint tags might take minutes to propagate. Sleeping.
# endpoint and training tags might take minutes to propagate. Sleeping.
time.sleep(30)
assert actual_tags == tags

Expand All @@ -235,7 +235,7 @@ def _assert_model_tags_match(sagemaker_client, model_name, tags):
def _assert_endpoint_tags_match(sagemaker_client, endpoint_name, tags):
endpoint_description = sagemaker_client.describe_endpoint(EndpointName=endpoint_name)

_assert_tags_match(sagemaker_client, endpoint_description["EndpointArn"], tags, retries=10)
_assert_tags_match(sagemaker_client, endpoint_description["EndpointArn"], tags)


def _assert_training_job_tags_match(sagemaker_client, training_job_name, tags):
Expand Down