Exemplo n.º 1
0
def get_act_target_count(node):
    nodename = node['name']
    infraid = node['infra_id']
    target_count = main_uds.get_scaling_target_count(infraid, nodename)
    target_count = 0 if target_count is None else target_count
    target_count = keep_limits_for_scaling(target_count, node)
    return target_count
Exemplo n.º 2
0
def report(instances):
    if not instances:
        raise Exception("Internal error: instances not found!")

    oneinstance = instances[list(instances.keys())[0]]
    infraid = oneinstance['infra_id']
    nodename = oneinstance['resolved_node_definition']['name']
    count = len(instances)

    target_count = int(
        util.coalesce(main_uds.get_scaling_target_count(infraid, nodename),
                      count))
    target_count += len(
        list(main_uds.get_scaling_createnode(infraid, nodename).keys()))
    target_count -= len(
        list(main_uds.get_scaling_destroynode(infraid, nodename).keys()))

    target_min, target_max = get_scaling_limits(
        oneinstance['node_description'])
    target_count = keep_limits_for_scaling(target_count,
                                           oneinstance['node_description'])

    return dict(actual=count,
                target=target_count,
                min=target_min,
                max=target_max)
Exemplo n.º 3
0
def get_act_target_count(node):
    nodename = node['name']
    infraid = node['infra_id']
    targetmin = node['scaling']['min']
    targetcount = int(util.coalesce(main_uds.get_scaling_target_count(infraid,nodename),
                    targetmin))
    return targetcount
Exemplo n.º 4
0
def get_act_target_count(node):
    nodename = node['name']
    infraid = node['infra_id']
    targetmin, targetmax = get_scaling_limits(node)
    targetcount = int(
        util.coalesce(main_uds.get_scaling_target_count(infraid, nodename),
                      targetmin))
    return targetcount
Exemplo n.º 5
0
 def node_creating(self, instance_data):
     """ Store event: Node creation started """
     infra_id = instance_data['infra_id']
     node_name = instance_data['node_description']['name']
     scaling_target_count = main_uds.get_scaling_target_count(
         infra_id, node_name)
     self.log_event(
         infra_id,
         'nodecreating',
         node_id=instance_data['node_id'],
         node_name=node_name,
         scaling_target_count=1
         if scaling_target_count is None else scaling_target_count,
     )
Exemplo n.º 6
0
def report(instances):
    if not instances:
        raise Exception("Internal error: instances not found!")
    
    oneinstance = instances[instances.keys()[0]]
    infraid = oneinstance['infra_id']
    nodename = oneinstance['resolved_node_definition']['name']
    count = len(instances)
    
    target_count = int(util.coalesce(main_uds.get_scaling_target_count(infraid,nodename),
                    count))
    target_count += len(main_uds.get_scaling_createnode(infraid,nodename).keys())
    target_count -= len(main_uds.get_scaling_destroynode(infraid,nodename).keys())

    target_min = oneinstance['node_description'].get('scaling',dict()).get('min',1)
    target_max = oneinstance['node_description'].get('scaling',dict()).get('max',1)

    target_count = max(target_count,target_min)
    target_count = min(target_count,target_max)

    return dict(actual=count, target=target_count, min=target_min,
            max=target_max)