Skip to content

Commit 09e9aaa

Browse files
danabensjerrypeng7773
authored andcommitted
fix: Add more logging when unexpected number of artifacts found (aws#3065)
1 parent 05db4bd commit 09e9aaa

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

tests/integ/sagemaker/lineage/conftest.py

+18-3
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,12 @@ def static_endpoint_context(sagemaker_session, static_pipeline_execution_arn):
663663
contexts = sagemaker_session.sagemaker_client.list_contexts(SourceUri=endpoint_arn)[
664664
"ContextSummaries"
665665
]
666-
if len(contexts) != 1:
666+
667+
logging.info(f"Found {len(contexts)} contexts associated with {endpoint_arn}")
668+
for ctx in contexts:
669+
logging.info(f'Found context "{ctx["ContextArn"]}"')
670+
671+
if len(contexts) == 0:
667672
raise (
668673
Exception(
669674
f"Got an unexpected number of Contexts for \
@@ -689,7 +694,12 @@ def static_model_package_group_context(sagemaker_session, static_pipeline_execut
689694
contexts = sagemaker_session.sagemaker_client.list_contexts(SourceUri=model_package_group_arn)[
690695
"ContextSummaries"
691696
]
692-
if len(contexts) != 1:
697+
698+
logging.info(f"Found {len(contexts)} contexts associated with {model_package_group_arn}")
699+
for ctx in context:
700+
logging.info(f'Found context "{ctx["ContextArn"]}"')
701+
702+
if len(contexts) == 0:
693703
raise (
694704
Exception(
695705
f"Got an unexpected number of Contexts for \
@@ -713,7 +723,12 @@ def static_model_artifact(sagemaker_session, static_pipeline_execution_arn):
713723
artifacts = sagemaker_session.sagemaker_client.list_artifacts(SourceUri=model_package_arn)[
714724
"ArtifactSummaries"
715725
]
716-
if len(artifacts) != 1:
726+
727+
logging.info(f"Found {len(artifacts)} artifacts associated with {model_package_arn}")
728+
for art in artifacts:
729+
logging.info(f'Found artifact {art["ArtifactArn"]}')
730+
731+
if len(artifacts) == 0:
717732
raise (
718733
Exception(
719734
f"Got an unexpected number of Artifacts for \

0 commit comments

Comments
 (0)