Skip to content

Commit b8b9aa3

Browse files
committed
fix: update get_execution_role to directly return the ExecutionRoleArn if it presents in the resource metadata file
For commit: aws/sagemaker-python-sdk-staging@b9df334
1 parent 3739879 commit b8b9aa3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

sagemaker-core/src/sagemaker/core/helper/session_helper.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -330,16 +330,16 @@ def get_caller_identity_arn(self):
330330
user_profile_name = metadata.get("UserProfileName")
331331
execution_role_arn = metadata.get("ExecutionRoleArn")
332332
try:
333+
# find execution role from the metadata file if present
334+
if execution_role_arn is not None:
335+
return execution_role_arn
336+
333337
if domain_id is None:
334338
instance_desc = self.sagemaker_client.describe_notebook_instance(
335339
NotebookInstanceName=instance_name
336340
)
337341
return instance_desc["RoleArn"]
338342

339-
# find execution role from the metadata file if present
340-
if execution_role_arn is not None:
341-
return execution_role_arn
342-
343343
user_profile_desc = self.sagemaker_client.describe_user_profile(
344344
DomainId=domain_id, UserProfileName=user_profile_name
345345
)

0 commit comments

Comments
 (0)