in hostfactory/host_provider/src/cluster.py [0:0]
def add_nodes(self, request_id, template_id, requested_slot_count, use_weighted_templates=False, vm_types={},
capacity_limit_timeout=300, autoscaling_strategy="price", dry_run=False):
# Add custom resources for nodes in scalelib (each pass may be a new process, so do this each time)
self.configure_node_resources_scalelib(use_weighted_templates, vm_types)
allocation_strategy = AllocationStrategy(self.node_mgr, self.provider_config, strategy=autoscaling_strategy,
capacity_limit_timeout=capacity_limit_timeout, logger=self.logger)
allocation_results = allocation_strategy.allocate_slots(requested_slot_count, template_id, vm_types)
by_vm_size = partition(self.node_mgr.new_nodes, lambda node: node.vm_size)
for key,value in by_vm_size.items():
self.logger.info("Requesting %s nodes of %s", len(value), key)
if dry_run:
self.logger.info("Dry run: Would have booted %s nodes", len(self.node_mgr.new_nodes))
return True
if allocation_results:
request_id_start = f"{request_id}-start"
request_id_create = f"{request_id}-create"
result = self.node_mgr.bootup(request_id_start=request_id_start, request_id_create=request_id_create)
return result
return False