@@ -34,7 +34,7 @@ def _get_resources_from_compute_quotas(instance_type: str,
3434 accelerators : Optional [int ] = 0 ,
3535 accelerator_partition_type : Optional [str ] = None ,
3636 accelerator_partition_count : Optional [int ] = None ,
37- efa : Optional [int ] = None ) -> Optional [dict ]:
37+ efa_interfaces : Optional [int ] = None ) -> Optional [dict ]:
3838 has_accelerator_partition = accelerator_partition_type is not None and accelerator_partition_count is not None
3939 has_compute_resources = _has_compute_resource_quota_allocation_resources (memory_in_gib , vcpu , accelerators )
4040
@@ -73,7 +73,7 @@ def _get_resources_from_compute_quotas(instance_type: str,
7373 result ["memory" ] = memory_value
7474 result [type_of_accelerator ] = accelerators
7575
76- efa_count = efa or instance .get ("efa" , 0 )
76+ efa_count = efa_interfaces or instance .get ("efa" , 0 )
7777 if efa_count > 0 :
7878 result ["vpc.amazonaws.com/efa" ] = efa_count
7979
@@ -135,7 +135,7 @@ def _trim_resource_requests(instance_type: str, requests_values: dict) -> dict:
135135 return requests_values
136136
137137
138- def _get_limits (instance_type : str , vcpu_limit : Optional [float ], memory_in_gib_limit : Optional [float ], accelerators_limit : Optional [int ], accelerator_partition_type : Optional [str ], accelerator_partition_limit : Optional [int ], efa_limit : Optional [int ] = None ) -> dict :
138+ def _get_limits (instance_type : str , vcpu_limit : Optional [float ], memory_in_gib_limit : Optional [float ], accelerators_limit : Optional [int ], accelerator_partition_type : Optional [str ], accelerator_partition_limit : Optional [int ], efa_interfaces_limit : Optional [int ] = None ) -> dict :
139139
140140 result = {}
141141 type_of_accelerator , _max_accelerator_per_instance = _get_accelerator_type_and_count (instance_type )
@@ -154,8 +154,8 @@ def _get_limits(instance_type: str, vcpu_limit: Optional[float], memory_in_gib_l
154154 if memory_in_gib_limit is not None :
155155 result ["memory" ] = str (memory_in_gib_limit ) + "Gi"
156156
157- if efa_limit is not None and efa_limit > 0 :
158- result ["vpc.amazonaws.com/efa" ] = efa_limit
157+ if efa_interfaces_limit is not None and efa_interfaces_limit > 0 :
158+ result ["vpc.amazonaws.com/efa" ] = efa_interfaces_limit
159159
160160 return result
161161
@@ -226,29 +226,29 @@ def _validate_accelerators_inputs(instance_type: str, accelerators_request: int,
226226 raise ValueError ('Requested accelerators exceeds capacity' )
227227
228228
229- def _validate_efa_inputs (instance_type : str , efa_request : Optional [int ], efa_limit : Optional [int ]) -> None :
229+ def _validate_efa_inputs (instance_type : str , efa_interfaces : Optional [int ], efa_interfaces_limit : Optional [int ]) -> None :
230230 """Validate EFA inputs similar to accelerator validation."""
231231 instance = INSTANCE_RESOURCES .get (instance_type , {})
232232 max_efa_per_instance = instance .get ("efa" , 0 )
233233
234234 # Check if user provided EFA values but instance doesn't support EFA
235- if max_efa_per_instance == 0 and (efa_request is not None or efa_limit is not None ):
235+ if max_efa_per_instance == 0 and (efa_interfaces is not None or efa_interfaces_limit is not None ):
236236 raise ValueError (
237237 f"Instance type { instance_type } does not support EFA, but EFA values were provided." )
238238
239239 # Validate EFA values if instance supports EFA
240240 if max_efa_per_instance > 0 :
241- if efa_request is not None and efa_limit is not None :
242- if efa_request != efa_limit :
241+ if efa_interfaces is not None and efa_interfaces_limit is not None :
242+ if efa_interfaces != efa_interfaces_limit :
243243 raise ValueError ('EFA request must equal EFA limit' )
244- if efa_limit > max_efa_per_instance :
245- raise ValueError (f'Requested EFA limit ({ efa_limit } ) exceeds instance capacity ({ max_efa_per_instance } )' )
246- if efa_request > max_efa_per_instance :
247- raise ValueError (f'Requested EFA ({ efa_request } ) exceeds instance capacity ({ max_efa_per_instance } )' )
248- elif efa_request is not None and efa_request > max_efa_per_instance :
249- raise ValueError (f'Requested EFA ({ efa_request } ) exceeds instance capacity ({ max_efa_per_instance } )' )
250- elif efa_limit is not None and efa_limit > max_efa_per_instance :
251- raise ValueError (f'Requested EFA limit ({ efa_limit } ) exceeds instance capacity ({ max_efa_per_instance } )' )
244+ if efa_interfaces_limit > max_efa_per_instance :
245+ raise ValueError (f'Requested EFA limit ({ efa_interfaces_limit } ) exceeds instance capacity ({ max_efa_per_instance } )' )
246+ if efa_interfaces > max_efa_per_instance :
247+ raise ValueError (f'Requested EFA ({ efa_interfaces } ) exceeds instance capacity ({ max_efa_per_instance } )' )
248+ elif efa_interfaces is not None and efa_interfaces > max_efa_per_instance :
249+ raise ValueError (f'Requested EFA ({ efa_interfaces } ) exceeds instance capacity ({ max_efa_per_instance } )' )
250+ elif efa_interfaces_limit is not None and efa_interfaces_limit > max_efa_per_instance :
251+ raise ValueError (f'Requested EFA limit ({ efa_interfaces_limit } ) exceeds instance capacity ({ max_efa_per_instance } )' )
252252
253253
254254def _set_default_accelerators_val (instance_type : Optional [str ], accelerators_request : Optional [int ], accelerators_limit : Optional [int ]) -> Tuple [Optional [int ], Optional [int ]]:
0 commit comments