|
36 | 36 | from tests.integ.sagemaker.lineage.helpers import name, names
|
37 | 37 |
|
38 | 38 | SLEEP_TIME_SECONDS = 1
|
39 |
| -STATIC_PIPELINE_NAME = "SdkIntegTestStaticPipeline14" |
40 |
| -STATIC_ENDPOINT_NAME = "SdkIntegTestStaticEndpoint14" |
| 39 | +STATIC_PIPELINE_NAME = "SdkIntegTestStaticPipeline15" |
| 40 | +STATIC_ENDPOINT_NAME = "SdkIntegTestStaticEndpoint15" |
41 | 41 |
|
42 | 42 |
|
43 | 43 | @pytest.fixture
|
@@ -518,6 +518,13 @@ def _get_static_pipeline_execution_arn(sagemaker_session):
|
518 | 518 | def static_endpoint_context(sagemaker_session, static_pipeline_execution_arn):
|
519 | 519 | endpoint_arn = get_endpoint_arn_from_static_pipeline(sagemaker_session)
|
520 | 520 |
|
| 521 | + if endpoint_arn is None: |
| 522 | + _deploy_static_endpoint( |
| 523 | + execution_arn=static_pipeline_execution_arn, |
| 524 | + sagemaker_session=sagemaker_session, |
| 525 | + ) |
| 526 | + endpoint_arn = get_endpoint_arn_from_static_pipeline(sagemaker_session) |
| 527 | + |
521 | 528 | contexts = sagemaker_session.sagemaker_client.list_contexts(SourceUri=endpoint_arn)[
|
522 | 529 | "ContextSummaries"
|
523 | 530 | ]
|
@@ -584,11 +591,17 @@ def static_dataset_artifact(static_model_artifact, sagemaker_session):
|
584 | 591 |
|
585 | 592 |
|
586 | 593 | def get_endpoint_arn_from_static_pipeline(sagemaker_session):
|
587 |
| - endpoint_arn = sagemaker_session.sagemaker_client.describe_endpoint( |
588 |
| - EndpointName=STATIC_ENDPOINT_NAME |
589 |
| - )["EndpointArn"] |
| 594 | + try: |
| 595 | + endpoint_arn = sagemaker_session.sagemaker_client.describe_endpoint( |
| 596 | + EndpointName=STATIC_ENDPOINT_NAME |
| 597 | + )["EndpointArn"] |
590 | 598 |
|
591 |
| - return endpoint_arn |
| 599 | + return endpoint_arn |
| 600 | + except ClientError as e: |
| 601 | + error = e.response["Error"] |
| 602 | + if error["Code"] == "ValidationException": |
| 603 | + return None |
| 604 | + raise e |
592 | 605 |
|
593 | 606 |
|
594 | 607 | def get_model_package_arn_from_static_pipeline(pipeline_execution_arn, sagemaker_session):
|
@@ -654,7 +667,7 @@ def _deploy_static_endpoint(execution_arn, sagemaker_session):
|
654 | 667 | sagemaker_session=sagemaker_session,
|
655 | 668 | )
|
656 | 669 | model_package.deploy(1, "ml.t2.medium", endpoint_name=STATIC_ENDPOINT_NAME)
|
657 |
| - time.sleep(60) |
| 670 | + time.sleep(120) |
658 | 671 | except ClientError as e:
|
659 | 672 | if e.response["Error"]["Code"] == "ValidationException":
|
660 | 673 | print(f"Endpoint {STATIC_ENDPOINT_NAME} already exists. Continuing.")
|
|
0 commit comments