@@ -117,7 +117,7 @@ def _fill_config_with_defaults(self, ads_config_path: str) -> None:
117117 else :
118118 self .config ["execution" ]["auth" ] = AuthType .API_KEY
119119 # determine profile
120- if self .config ["execution" ]["auth" ] == AuthType .RESOURCE_PRINCIPAL :
120+ if self .config ["execution" ]["auth" ] != AuthType .API_KEY :
121121 profile = self .config ["execution" ]["auth" ].upper ()
122122 exec_config .pop ("oci_profile" , None )
123123 self .config ["execution" ]["oci_profile" ] = None
@@ -202,20 +202,23 @@ def _get_service_config(self, oci_profile: str, ads_config_folder: str) -> Dict:
202202 def _config_flex_shape_details (self ):
203203 infrastructure = self .config ["infrastructure" ]
204204 backend = self .config ["execution" ].get ("backend" , None )
205- if backend == BACKEND_NAME .JOB .value or backend == BACKEND_NAME .MODEL_DEPLOYMENT .value :
205+ if (
206+ backend == BACKEND_NAME .JOB .value
207+ or backend == BACKEND_NAME .MODEL_DEPLOYMENT .value
208+ ):
206209 shape_name = infrastructure .get ("shape_name" , "" )
207210 if shape_name .endswith (".Flex" ):
208211 if (
209- "ocpus" not in infrastructure or
210- "memory_in_gbs" not in infrastructure
212+ "ocpus" not in infrastructure
213+ or "memory_in_gbs" not in infrastructure
211214 ):
212215 raise ValueError (
213216 "Parameters `ocpus` and `memory_in_gbs` must be provided for using flex shape. "
214217 "Call `ads opctl config` to specify."
215218 )
216219 infrastructure ["shape_config_details" ] = {
217220 "ocpus" : infrastructure .pop ("ocpus" ),
218- "memory_in_gbs" : infrastructure .pop ("memory_in_gbs" )
221+ "memory_in_gbs" : infrastructure .pop ("memory_in_gbs" ),
219222 }
220223 elif backend == BACKEND_NAME .DATAFLOW .value :
221224 executor_shape = infrastructure .get ("executor_shape" , "" )
@@ -224,7 +227,7 @@ def _config_flex_shape_details(self):
224227 "driver_shape_memory_in_gbs" ,
225228 "driver_shape_ocpus" ,
226229 "executor_shape_memory_in_gbs" ,
227- "executor_shape_ocpus"
230+ "executor_shape_ocpus" ,
228231 ]
229232 # executor_shape and driver_shape must be the same shape family
230233 if executor_shape .endswith (".Flex" ) or driver_shape .endswith (".Flex" ):
@@ -236,9 +239,9 @@ def _config_flex_shape_details(self):
236239 )
237240 infrastructure ["driver_shape_config" ] = {
238241 "ocpus" : infrastructure .pop ("driver_shape_ocpus" ),
239- "memory_in_gbs" : infrastructure .pop ("driver_shape_memory_in_gbs" )
242+ "memory_in_gbs" : infrastructure .pop ("driver_shape_memory_in_gbs" ),
240243 }
241244 infrastructure ["executor_shape_config" ] = {
242245 "ocpus" : infrastructure .pop ("executor_shape_ocpus" ),
243- "memory_in_gbs" : infrastructure .pop ("executor_shape_memory_in_gbs" )
246+ "memory_in_gbs" : infrastructure .pop ("executor_shape_memory_in_gbs" ),
244247 }
0 commit comments