Skip to content

Commit 876dd80

Browse files
committed
fix: handle bad jumpstart default session
1 parent 774706d commit 876dd80

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/sagemaker/jumpstart/constants.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,13 @@
179179

180180
JUMPSTART_LOGGER = logging.getLogger("sagemaker.jumpstart")
181181

182-
DEFAULT_JUMPSTART_SAGEMAKER_SESSION = Session(
183-
boto3.Session(region_name=JUMPSTART_DEFAULT_REGION_NAME)
184-
)
182+
try:
183+
DEFAULT_JUMPSTART_SAGEMAKER_SESSION = Session(
184+
boto3.Session(region_name=JUMPSTART_DEFAULT_REGION_NAME)
185+
)
186+
except Exception as e:
187+
DEFAULT_JUMPSTART_SAGEMAKER_SESSION = None
188+
JUMPSTART_LOGGER.warn(
189+
"Unable to create default JumpStart SageMaker Session due to the following error: %s.",
190+
str(e),
191+
)

0 commit comments

Comments
 (0)