@@ -90,25 +90,22 @@ def _fetch_hub_bucket_name(self) -> str:
90
90
if hub_output_location :
91
91
location = create_s3_object_reference_from_uri (hub_output_location )
92
92
return location .bucket
93
- default_bucket_name = generate_default_hub_bucket_name (self ._sagemaker_session )
94
93
JUMPSTART_LOGGER .warning (
95
- "There is not a Hub bucket associated with %s. Using %s " ,
94
+ "There is not a Hub bucket associated with %s." ,
96
95
self .hub_name ,
97
- default_bucket_name ,
98
96
)
99
- return default_bucket_name
97
+ return None
100
98
except exceptions .ClientError :
101
- hub_bucket_name = generate_default_hub_bucket_name (self ._sagemaker_session )
102
99
JUMPSTART_LOGGER .warning (
103
- "There is not a Hub bucket associated with %s. Using %s " ,
100
+ "There is not a Hub bucket associated with %s." ,
104
101
self .hub_name ,
105
- hub_bucket_name ,
106
102
)
107
- return hub_bucket_name
108
-
103
+ return None
109
104
def _generate_hub_storage_location (self , bucket_name : Optional [str ] = None ) -> None :
110
105
"""Generates an ``S3ObjectLocation`` given a Hub name."""
111
106
hub_bucket_name = bucket_name or self ._fetch_hub_bucket_name ()
107
+ if hub_bucket_name is None :
108
+ return
112
109
curr_timestamp = datetime .now ().timestamp ()
113
110
return S3ObjectLocation (bucket = hub_bucket_name , key = f"{ self .hub_name } -{ curr_timestamp } " )
114
111
@@ -131,16 +128,16 @@ def create(
131
128
) -> Dict [str , str ]:
132
129
"""Creates a hub with the given description"""
133
130
134
- create_hub_bucket_if_it_does_not_exist (
135
- self .hub_storage_location .bucket , self . _sagemaker_session
136
- )
131
+ s3_storage_config = {
132
+ "S3OutputPath" : self .hub_storage_location .get_uri ()
133
+ } if self . hub_storage_location else None
137
134
138
135
return self ._sagemaker_session .create_hub (
139
136
hub_name = self .hub_name ,
140
137
hub_description = description ,
141
138
hub_display_name = display_name ,
142
139
hub_search_keywords = search_keywords ,
143
- s3_storage_config = { "S3OutputPath" : self . hub_storage_location . get_uri ()} ,
140
+ s3_storage_config = s3_storage_config ,
144
141
tags = tags ,
145
142
)
146
143
0 commit comments