Пример #1
0
def update_instance_data(args):
    azure_pricing = get_pricing()
    jsonfp = dumpjson(azure_pricing)
    if args.upload:
        upload('azure_instance_data.json', jsonfp)
    else:
        write_go('azure', jsonfp, dumpjson({}))
Пример #2
0
def update_instance_data(args):
    print('loading raw instance data')
    raw_data = get_raw_instance_data()
    print('getting instance data')
    simple_instance_data = get_instance_data(raw_data)
    jsonfp = dumpjson(simple_instance_data)
    if args.upload:
        upload('aws_instance_data.json', jsonfp)
    else:
        write_go('aws', jsonfp, dumpjson({}))
Пример #3
0
def update_instance_data(args):
    raw_data = get_raw_instance_data()
    simple_instance_data = get_instance_data(raw_data)
    jsonfp = dumpjson(simple_instance_data)
    if args.upload:
        upload('aws_instance_data.json', jsonfp)
    else:
        write_go('aws', jsonfp)
Пример #4
0
        for family in families_available:
            if family not in machine_families_for_custom_vm_sizes:
                continue
            gpus = get_available_gpus(zone, family, supported_gpus)
            data = make_custom_instance_data(zone, family, pricing, gpus)
            if data:
                zone_custom_vm_data.append(data)
        instance_data[zone] = zone_data
        custom_instance_data[zone] = zone_custom_vm_data
    return instance_data, custom_instance_data


if __name__ == '__main__':
    parser = argparse.ArgumentParser(
        description=__doc__,
        formatter_class=argparse.RawDescriptionHelpFormatter)
    parser.add_argument('--project_id',
                        help='Google Cloud project ID.',
                        default='elotl-kip')
    parser.add_argument('--upload', action="store_true", default=False)
    args = parser.parse_args()
    instance_data, custom_instance_data = get_instance_data(args.project_id)
    if args.upload:
        jsonfp = dumpjson(instance_data)
        upload('gce_instance_data.json', jsonfp)
        jsonfp = dumpjson(custom_instance_data)
        upload('gce_custom_instance_data.json', jsonfp)
    else:
        write_go('gce', dumpjson(instance_data),
                 dumpjson(custom_instance_data))
    skus = get_compute_skus()
    client = googleapiclient.discovery.build('compute', 'v1')
    zones = get_all_zones(client, project)
    supportedGPUTypes = get_supported_gpus(client, project, zones)
    regions = set([zone_to_region(z) for z in zones])
    machines = list_all_machine_types(client, project, zones)
    pricing_by_region = create_pricing_map(regions, skus)
    instance_data = {}
    for zone, machines in machines.iteritems():
        region = zone_to_region(zone)
        zone_data = []
        pricing = pricing_by_region[region]
        for machine in machines:
            gpus = get_available_gpus(zone, machine, supportedGPUTypes)
            zone_data.append(make_instance_data(machine, pricing, gpus))
        instance_data[zone] = zone_data
    return instance_data


if __name__ == '__main__':
    parser = argparse.ArgumentParser(
        description=__doc__,
        formatter_class=argparse.RawDescriptionHelpFormatter)
    parser.add_argument('--project_id',
                        help='Google Cloud project ID.',
                        default='elotl-kip')
    args = parser.parse_args()
    instance_data = get_instance_data(args.project_id)
    jsonfp = dumpjson(instance_data)
    write_go('gce', jsonfp)
Пример #6
0
def update_storage_data(args):
    pricing = get_storage_pricing()
    jsonfp = dumpjson(pricing)
    if args.upload:
        upload('aws_storage_data.json', jsonfp)
Пример #7
0
def update_network_data(args):
    elb_pricing = get_elb_pricing()
    jsonfp = dumpjson(elb_pricing)
    if args.upload:
        upload('aws_network_data.json', jsonfp)