(
        self, resource_request: SignalResourceRequest, cluster_total_resources: ClustermanResources,
    )
return max(requested_resource_usage_pcts.items(), key=lambda x: x[1])
Determine what would be the most constrained resource if were to fulfill a resource_request without scaling
        the cluster.

        :param resource_rquest: dictionary of resource name (cpu, mem, disk) to the requested quantity of that resource
        :param cluster_total_resources: the currently available resources in the cluster
        :returns: a tuple of the most constrained resource name and its utilization percentage if the provided request
            were to be fulfilled
Determine what would be the most constrained resource if were to fulfill a resource_request without scaling
        the cluster.
Determine what would be the most constrained resource if were to fulfill a resource_request without scaling the cluster .
def _get_most_constrained_resource_for_request(
        self, resource_request: SignalResourceRequest, cluster_total_resources: ClustermanResources,
    ) -> Tuple[str, float]:
        """Determine what would be the most constrained resource if were to fulfill a resource_request without scaling
        the cluster.

        :param resource_rquest: dictionary of resource name (cpu, mem, disk) to the requested quantity of that resource
        :param cluster_total_resources: the currently available resources in the cluster
        :returns: a tuple of the most constrained resource name and its utilization percentage if the provided request
            were to be fulfilled
        """
        requested_resource_usage_pcts = {}
        for resource, resource_total in cluster_total_resources._asdict().items():
            resource_request_value = getattr(resource_request, resource)
            if resource_request_value is None:
                continue

            if resource in self.autoscaling_config.excluded_resources:
                logger.info(f"Signal requested {resource_total} {resource} but it is excluded from scaling decisions")
                continue

            if resource_total == 0:
                if resource_request_value > 0:
                    raise ResourceRequestError(
                        f"Signal requested {resource_request_value} for {resource} "
                        "but the cluster doesn't have any of that resource"
                    )
                requested_resource_usage_pcts[resource] = 0
            else:
                requested_resource_usage_pcts[resource] = resource_request_value / resource_total
        return max(requested_resource_usage_pcts.items(), key=lambda x: x[1])
def _get_most_constrained_resource_for_request ( self , resource_request : SignalResourceRequest , cluster_total_resources : ClustermanResources , ) -> Tuple [ str , float ] : requested_resource_usage_pcts = { } for resource , resource_total in cluster_total_resources . _asdict ( ) . items ( ) : resource_request_value = getattr ( resource_request , resource ) if resource_request_value is None : continue if resource in self . autoscaling_config . excluded_resources : logger . info ( f"Signal requested {resource_total} {resource} but it is excluded from scaling decisions" ) continue if resource_total == 0 : if resource_request_value > 0 : raise ResourceRequestError ( f"Signal requested {resource_request_value} for {resource} " "but the cluster doesn't have any of that resource" ) requested_resource_usage_pcts [ resource ] = 0 else : requested_resource_usage_pcts [ resource ] = resource_request_value / resource_total return max ( requested_resource_usage_pcts . items ( ) , key = lambda x : x [ 1 ] )