Exemplo n.º 1
0
def update_jobs_fleet_instances(optimal_cnts, autoscaling_group, max_inst, min_inst, cnts_per_inst):
	current_instances = autoscaling.get_capacity(autoscaling_group)
	optimal_instances = calculate_optimal_job_instance_capacity(optimal_cnts, cnts_per_inst)
	tasks_log.info("JobsInstances - Current:%s Optimal:%s" % (str(current_instances), str(optimal_instances)))
	if optimal_instances > current_instances and current_instances < max_inst:
		tasks_log.info("Jobs - Increasing Instance Capacity")
		autoscaling.increase_capacity(autoscaling_group)
		return current_instances+1
	elif optimal_instances < current_instances and current_instances > min_inst:
		tasks_log.info("Jobs - Reducing Instance Capacity")
		autoscaling.decrease_capacity(autoscaling_group)
		return current_instances-1
	else:
		tasks_log.info("Jobs - Leaving Instance Capacity Unchanged")
		return current_instances
Exemplo n.º 2
0
def update_jobs_fleet_instances(optimal_cnts, autoscaling_group, max_inst,
                                min_inst, cnts_per_inst):
    current_instances = autoscaling.get_capacity(autoscaling_group)
    optimal_instances = calculate_optimal_job_instance_capacity(
        optimal_cnts, cnts_per_inst)
    tasks_log.info("JobsInstances - Current:%s Optimal:%s" %
                   (str(current_instances), str(optimal_instances)))
    if optimal_instances > current_instances and current_instances < max_inst:
        tasks_log.info("Jobs - Increasing Instance Capacity")
        autoscaling.increase_capacity(autoscaling_group)
        return current_instances + 1
    elif optimal_instances < current_instances and current_instances > min_inst:
        tasks_log.info("Jobs - Reducing Instance Capacity")
        autoscaling.decrease_capacity(autoscaling_group)
        return current_instances - 1
    else:
        tasks_log.info("Jobs - Leaving Instance Capacity Unchanged")
        return current_instances
Exemplo n.º 3
0
def update_job_items_fleet_instances(autoscaling_grp, max_insts, min_insts, cntrs_per_inst, cntrs):
	"""
	Fast scale up. Slow scale down.
	"""
	current_instances = autoscaling.get_capacity(autoscaling_grp)
	optimal_instances = calculate_optimal_job_item_instance_capacity(cntrs_per_inst, cntrs)
	tasks_log.info("JobItemsInstances: Current:%s Optimal:%s" % (str(current_instances), 
		str(optimal_instances)))
	if optimal_instances > current_instances and current_instances < max_insts:
		tasks_log.info("JobItems - Increasing Instance Capacity")
		autoscaling.increase_capacity(autoscaling_grp)
		return current_instances+1
	elif optimal_instances < current_instances and current_instances > min_insts:
		tasks_log.info("JobItems - Reducing Instance Capacity")
		autoscaling.decrease_capacity(autoscaling_grp)
		return current_instances-1
	else:
		tasks_log.info("JobItems - Leaving Instance Capacity Unchanged")
		return current_instances
Exemplo n.º 4
0
def update_job_items_fleet_instances(autoscaling_grp, max_insts, min_insts,
                                     cntrs_per_inst, cntrs):
    """
	Fast scale up. Slow scale down.
	"""
    current_instances = autoscaling.get_capacity(autoscaling_grp)
    optimal_instances = calculate_optimal_job_item_instance_capacity(
        cntrs_per_inst, cntrs)
    tasks_log.info("JobItemsInstances: Current:%s Optimal:%s" %
                   (str(current_instances), str(optimal_instances)))
    if optimal_instances > current_instances and current_instances < max_insts:
        tasks_log.info("JobItems - Increasing Instance Capacity")
        autoscaling.increase_capacity(autoscaling_grp)
        return current_instances + 1
    elif optimal_instances < current_instances and current_instances > min_insts:
        tasks_log.info("JobItems - Reducing Instance Capacity")
        autoscaling.decrease_capacity(autoscaling_grp)
        return current_instances - 1
    else:
        tasks_log.info("JobItems - Leaving Instance Capacity Unchanged")
        return current_instances
Exemplo n.º 5
0
def test_increase_capacity(group):
    initial_capacity = autoscaling.get_capacity(group)
    autoscaling.increase_capacity(group)
    result = wait_for_capacity_change(autoscaling, group, initial_capacity + 1)
    assert result is True