Skip to content

Commit 6d6345c

Browse files
author
Malav Shastri
committed
fix codestyle
1 parent 964de22 commit 6d6345c

File tree

3 files changed

+14
-17
lines changed

3 files changed

+14
-17
lines changed

src/sagemaker/jumpstart/accessors.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,9 @@ def get_model_specs(
300300
return model_specs
301301

302302
except Exception as ex:
303-
logging.info("Recieved expection while calling APIs for ContentType Model: " + str(ex))
303+
logging.info(
304+
"Recieved expection while calling APIs for ContentType Model: " + str(ex)
305+
)
304306
hub_model_arn = construct_hub_model_arn_from_inputs(
305307
hub_arn=hub_arn, model_name=model_id, version=version
306308
)

src/sagemaker/jumpstart/factory/model.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@
3434
JUMPSTART_LOGGER,
3535
)
3636
from sagemaker.model_card.model_card import ModelCard, ModelPackageModelCard
37-
from sagemaker.jumpstart.hub.utils import construct_hub_model_arn_from_inputs, construct_hub_model_reference_arn_from_inputs
37+
from sagemaker.jumpstart.hub.utils import (
38+
construct_hub_model_arn_from_inputs,
39+
construct_hub_model_reference_arn_from_inputs,
40+
)
3841
from sagemaker.model_metrics import ModelMetrics
3942
from sagemaker.metadata_properties import MetadataProperties
4043
from sagemaker.drift_check_baselines import DriftCheckBaselines
@@ -552,15 +555,11 @@ def _add_tags_to_kwargs(kwargs: JumpStartModelDeployKwargs) -> Dict[str, Any]:
552555
if kwargs.hub_arn:
553556
if kwargs.model_reference_arn:
554557
hub_content_arn = construct_hub_model_reference_arn_from_inputs(
555-
kwargs.hub_arn,
556-
kwargs.model_id,
557-
kwargs.model_version
558+
kwargs.hub_arn, kwargs.model_id, kwargs.model_version
558559
)
559560
else:
560561
hub_content_arn = construct_hub_model_arn_from_inputs(
561-
kwargs.hub_arn,
562-
kwargs.model_id,
563-
kwargs.model_version
562+
kwargs.hub_arn, kwargs.model_id, kwargs.model_version
564563
)
565564
kwargs.tags = add_hub_content_arn_tags(kwargs.tags, hub_content_arn=hub_content_arn)
566565

src/sagemaker/jumpstart/hub/hub.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,29 +82,25 @@ def __init__(
8282
self._sagemaker_session = sagemaker_session
8383
self.hub_storage_location = self._generate_hub_storage_location(bucket_name)
8484

85-
def _fetch_hub_bucket_name(self) -> str:
85+
def _fetch_hub_bucket_name(self) -> Optional[str]:
8686
"""Retrieves hub bucket name from Hub config if exists"""
8787
try:
8888
hub_response = self._sagemaker_session.describe_hub(hub_name=self.hub_name)
8989
hub_output_location = hub_response["S3StorageConfig"].get("S3OutputPath")
9090
if hub_output_location:
9191
location = create_s3_object_reference_from_uri(hub_output_location)
9292
return location.bucket
93-
default_bucket_name = generate_default_hub_bucket_name(self._sagemaker_session)
9493
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.",
9695
self.hub_name,
97-
default_bucket_name,
9896
)
99-
return default_bucket_name
97+
return None
10098
except exceptions.ClientError:
101-
hub_bucket_name = generate_default_hub_bucket_name(self._sagemaker_session)
10299
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.",
104101
self.hub_name,
105-
hub_bucket_name,
106102
)
107-
return hub_bucket_name
103+
return None
108104

109105
def _generate_hub_storage_location(self, bucket_name: Optional[str] = None) -> None:
110106
"""Generates an ``S3ObjectLocation`` given a Hub name."""

0 commit comments

Comments
 (0)