in hostfactory/host_provider/src/allocation_strategy.py [0:0]
def allocate_slots(self, requested_slot_count, template_id, vm_types):
# capacity_limit_timeout: Time in seconds to check waiting period after last capacity failure
logging.info("Allocating %s slots for template_id %s using strategy %s", requested_slot_count,
template_id, self.auto_scaling_strategy)
# Filter out vmTypes that have no available capacity
filtered_vm_types = self.filter_available_vmTypes(vm_types)
if self.auto_scaling_strategy == AllocationStrategies.CAPACITY:
result = self.allocate_slots_capacity(requested_slot_count, template_id, filtered_vm_types)
elif self.auto_scaling_strategy == AllocationStrategies.WEIGHTED:
result = self.allocate_slots_weighted(requested_slot_count, template_id, filtered_vm_types)
elif self.auto_scaling_strategy == AllocationStrategies.DECAY:
result = self.allocate_slots_decay(requested_slot_count, template_id, filtered_vm_types)
else: # PRICE
result = self.allocate_slots_price(requested_slot_count, template_id, filtered_vm_types)
return result