@@ -72,21 +72,37 @@ def get_jumpstart_content_bucket(
72
72
RuntimeError: If JumpStart is not launched in ``region``.
73
73
"""
74
74
75
+ old_content_bucket : Optional [
76
+ str
77
+ ] = accessors .JumpStartModelsAccessor .get_jumpstart_content_bucket ()
78
+
79
+ info_logs : List [str ] = []
80
+
81
+ bucket_to_return : Optional [str ] = None
75
82
if (
76
83
constants .ENV_VARIABLE_JUMPSTART_CONTENT_BUCKET_OVERRIDE in os .environ
77
84
and len (os .environ [constants .ENV_VARIABLE_JUMPSTART_CONTENT_BUCKET_OVERRIDE ]) > 0
78
85
):
79
- bucket_override = os .environ [constants .ENV_VARIABLE_JUMPSTART_CONTENT_BUCKET_OVERRIDE ]
80
- constants .JUMPSTART_LOGGER .info ("Using JumpStart bucket override: '%s'" , bucket_override )
81
- return bucket_override
82
- try :
83
- return constants .JUMPSTART_REGION_NAME_TO_LAUNCHED_REGION_DICT [region ].content_bucket
84
- except KeyError :
85
- formatted_launched_regions_str = get_jumpstart_launched_regions_message ()
86
- raise ValueError (
87
- f"Unable to get content bucket for JumpStart in { region } region. "
88
- f"{ formatted_launched_regions_str } "
89
- )
86
+ bucket_to_return = os .environ [constants .ENV_VARIABLE_JUMPSTART_CONTENT_BUCKET_OVERRIDE ]
87
+ info_logs .append (f"Using JumpStart bucket override: '{ bucket_to_return } '" )
88
+ else :
89
+ try :
90
+ bucket_to_return = constants .JUMPSTART_REGION_NAME_TO_LAUNCHED_REGION_DICT [
91
+ region
92
+ ].content_bucket
93
+ except KeyError :
94
+ formatted_launched_regions_str = get_jumpstart_launched_regions_message ()
95
+ raise ValueError (
96
+ f"Unable to get content bucket for JumpStart in { region } region. "
97
+ f"{ formatted_launched_regions_str } "
98
+ )
99
+
100
+ accessors .JumpStartModelsAccessor .set_jumpstart_content_bucket (bucket_to_return )
101
+
102
+ if bucket_to_return != old_content_bucket :
103
+ for info_log in info_logs :
104
+ constants .JUMPSTART_LOGGER .info (info_log )
105
+ return bucket_to_return
90
106
91
107
92
108
def get_formatted_manifest (
0 commit comments