in docker/services/resize/resize_service.py [0:0]
def _adjust_too_large(self, shapes: List[Shape],
recommendation: RecommendationHistory):
recommended_shapes_data = self._get_recommended_shapes(
recommendation=recommendation,
max_items=SHAPES_COUNT_TO_ADJUST
)
recommended_cpu = [item.get('cpu') for item in recommended_shapes_data
if isinstance(item.get('cpu'), (int, float))]
recommended_memory = [item.get('memory') for item in
recommended_shapes_data
if isinstance(item.get('memory'), (int, float))]
threshold_cpu = min(recommended_cpu)
threshold_memory = min(recommended_memory)
result_shapes = []
for shape in shapes:
# shape cpu/memory must be <=, but
# at least one of them must be smaller than a threshold value
if shape.cpu <= threshold_cpu and shape.memory <= threshold_memory \
and (shape.cpu != threshold_cpu
or threshold_memory != shape.memory):
result_shapes.append(shape)
return result_shapes