Skip to content

Commit 1602823

Browse files
authored
fix: handle bad jumpstart default session (#4109)
1 parent 95caeba commit 1602823

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/sagemaker/jumpstart/constants.py

+10-3
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: # pylint: disable=W0703
187+
DEFAULT_JUMPSTART_SAGEMAKER_SESSION = None
188+
JUMPSTART_LOGGER.warning(
189+
"Unable to create default JumpStart SageMaker Session due to the following error: %s.",
190+
str(e),
191+
)

0 commit comments

Comments
 (0)