in src/sagemaker/session.py [0:0]
def _live_logging_deploy_done(sagemaker_client, endpoint_name, paginator, paginator_config, poll):
"""Placeholder docstring"""
stop = False
endpoint_status = None
try:
desc = sagemaker_client.describe_endpoint(EndpointName=endpoint_name)
endpoint_status = desc["EndpointStatus"]
except ClientError as e:
if e.response["Error"]["Code"] == "ValidationException":
LOGGER.debug("Waiting for endpoint to become visible")
return None
raise e
try:
# if endpoint is in an invalid state -> set stop to true, sleep, and flush the logs
if endpoint_status != "Creating":
stop = True
if endpoint_status == "InService":
LOGGER.info("Created endpoint with name %s", endpoint_name)
else:
time.sleep(poll)
pages = paginator.paginate(
logGroupName=f"/aws/sagemaker/Endpoints/{endpoint_name}",
logStreamNamePrefix="AllTraffic/",
PaginationConfig=paginator_config,
)
for page in pages:
if "nextToken" in page:
paginator_config["StartingToken"] = page["nextToken"]
for event in page["events"]:
LOGGER.info(event["message"])
else:
LOGGER.debug("No log events available")
# if stop is true -> return the describe response and stop polling
if stop:
return desc
except ClientError as e:
if e.response["Error"]["Code"] == "ResourceNotFoundException":
LOGGER.debug("Waiting for endpoint log group to appear")
return None
raise e
return None