Skip to content

Commit 17799ce

Browse files
authored
do not call create bucket if data location is provided (#96)
1 parent 515a6ed commit 17799ce

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/sagemaker/amazon/amazon_estimator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ def __init__(self, role, train_instance_count, train_instance_type, data_locatio
4242
super(AmazonAlgorithmEstimatorBase, self).__init__(role, train_instance_count, train_instance_type,
4343
**kwargs)
4444

45-
default_location = "s3://{}/sagemaker-record-sets/".format(self.sagemaker_session.default_bucket())
46-
data_location = data_location or default_location
45+
data_location = data_location or "s3://{}/sagemaker-record-sets/".format(
46+
self.sagemaker_session.default_bucket())
4747
self.data_location = data_location
4848

4949
def train_image(self):

tests/unit/test_amazon_estimator.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,13 @@ def test_data_location_validation(sagemaker_session):
8888
pca.data_location = "nots3://abcd/efgh"
8989

9090

91+
def test_data_location_does_not_call_default_bucket(sagemaker_session):
92+
data_location = "s3://my-bucket/path/"
93+
pca = PCA(num_components=2, sagemaker_session=sagemaker_session, data_location=data_location, **COMMON_ARGS)
94+
assert pca.data_location == data_location
95+
assert not sagemaker_session.default_bucket.called
96+
97+
9198
def test_pca_hyperparameters(sagemaker_session):
9299
pca = PCA(num_components=55, algorithm_mode='randomized',
93100
subtract_mean=True, extra_components=33, sagemaker_session=sagemaker_session,

0 commit comments

Comments
 (0)