(self)
return ClustermanResources(**weighted_resource_dict)
Compute the weighted value of each type of resource in the cluster

        returns: a ClustermanResources object with the weighted resource value, or 0 if it couldn't be determined
Compute the weighted value of each type of resource in the cluster
Compute the weighted value of each type of resource in the cluster
def _get_historical_weighted_resource_value(self) -> ClustermanResources:
        """ Compute the weighted value of each type of resource in the cluster

        returns: a ClustermanResources object with the weighted resource value, or 0 if it couldn't be determined
        """
        capacity_history = self._get_smoothed_non_zero_metadata(
            "non_orphan_fulfilled_capacity",
            time_start=arrow.now().shift(weeks=-1).timestamp,
            time_end=arrow.now().timestamp,
        )
        if not capacity_history:
            return ClustermanResources()
        time_start, time_end, non_orphan_fulfilled_capacity = capacity_history

        weighted_resource_dict: MutableMapping[str, float] = {}
        for resource in ClustermanResources._fields:
            resource_history = self._get_smoothed_non_zero_metadata(
                f"{resource}_total", time_start=time_start, time_end=time_end,
            )
            if not resource_history:
                weighted_resource_dict[resource] = 0
            else:
                weighted_resource_dict[resource] = resource_history[2] / non_orphan_fulfilled_capacity

        return ClustermanResources(**weighted_resource_dict)
def _get_historical_weighted_resource_value ( self ) -> ClustermanResources : capacity_history = self . _get_smoothed_non_zero_metadata ( "non_orphan_fulfilled_capacity" , time_start = arrow . now ( ) . shift ( weeks = - 1 ) . timestamp , time_end = arrow . now ( ) . timestamp , ) if not capacity_history : return ClustermanResources ( ) time_start , time_end , non_orphan_fulfilled_capacity = capacity_history weighted_resource_dict : MutableMapping [ str , float ] = { } for resource in ClustermanResources . _fields : resource_history = self . _get_smoothed_non_zero_metadata ( f"{resource}_total" , time_start = time_start , time_end = time_end , ) if not resource_history : weighted_resource_dict [ resource ] = 0 else : weighted_resource_dict [ resource ] = resource_history [ 2 ] / non_orphan_fulfilled_capacity return ClustermanResources ( * * weighted_resource_dict )