Skip to content

Commit f43b9c3

Browse files
jalabortowen-t
authored andcommitted
Correctly handle TooManyBuckets error_code in default_bucket method (aws#40)
* Update session.py Correctly handles the `TooManyBuckets` error_code when the bucket already exists.
1 parent e394710 commit f43b9c3

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/sagemaker/session.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,13 @@ def default_bucket(self):
170170
elif error_code == 'OperationAborted' and 'conflicting conditional operation' in message:
171171
# If this bucket is already being concurrently created, we don't need to create it again.
172172
pass
173+
elif error_code == 'TooManyBuckets':
174+
# Succeed if the default bucket exists
175+
try:
176+
s3.meta.client.head_bucket(Bucket=default_bucket)
177+
pass
178+
except ClientError:
179+
raise
173180
else:
174181
raise
175182

0 commit comments

Comments
 (0)