<commit_before>#!/usr/bin/env python

"""

Development setup:

gce.py create_smc_server --machine_type g1-small --disk_size=0 0-devel
gce.py create_compute_server --machine_type g1-small  0-devel

"""

import math, os, sys, argparse, json, time

TIMESTAMP_FORMAT = "%Y-%m-%d-%H%M%S"

import locale
locale.setlocale( locale.LC_ALL, '' )
def money(s):
    return locale.currency(s)

# https://cloud.google.com/compute/pricing

# all storage prices are per GB per month.
PRICING = {
    'gcs-standard'     : 0.026,
    'gcs-reduced'      : 0.02,
    'gcs-nearline'     : 0.01,
    'snapshot'         : 0.026,
    'local-ssd'        : 0.218,
    'pd-ssd'           : 0.17,
    'pd-standard'      : 0.04,

    'n1-standard-hour' : 0.063,          # for equivalent of -1, so multiply by number of cpu's (the suffix)
    'n1-standard-month': 0.045*30.5*24,  # price for sustained use for a month
    'n1-standard-ram'  : 3.75,           # amount in GB of base machine

    'n1-highmem-hour'  : 0.074,
    'n1-highmem-month' : 0.052*30.5*24,
    'n1-highmem-ram'   : 6.5,

    'n1-highcpu-hour'  : 0.04,
    'n1-highcpu-month' : 0.028*30.5*24,
    'n1-highcpu-ram'   : 0.9,

    'g1-small-hour'    : 0.032,
    'g1-small-month'   : 0.023*30.5*24,
    'g1-small-ram'     : 1.7,

    'f1-micro-hour'    : 0.012,
    'f1-micro-month'   : 0.009*30.5*24,
    'f1-micro-ram'     : 0.60,

    'europe'           : 1.096,
    'asia'             : 1.096,
    'us'               : 1,

    'egress'           : 0.12,
    'egress-china'     : 0.23,
    'egress-australia' : 0.19,
}


sys.path.append(os.path.join(os.environ['SALVUS_ROOT'], 'scripts'))
from smc_firewall import log, cmd


class GCE(object):
    def __init__(self):
        self.project = "sage-math-inc"

    def instance_name(self, node, prefix, zone, devel):
        # the zone names have got annoyingly non-canonical...
        if prefix.startswith('smc'):
            zone = "-"+self.expand_zone(zone)
        elif prefix.startswith('compute') or prefix.startswith('storage'):
            zone = "-"+self.short_zone(zone)
        else:<commit_msg>enter new gce pricing<commit_after>#!/usr/bin/env python

"""

Development setup:

gce.py create_smc_server --machine_type g1-small --disk_size=0 0-devel
gce.py create_compute_server --machine_type g1-small  0-devel

"""

import math, os, sys, argparse, json, time

TIMESTAMP_FORMAT = "%Y-%m-%d-%H%M%S"

import locale
locale.setlocale( locale.LC_ALL, '' )
def money(s):
    return locale.currency(s)

# https://cloud.google.com/compute/pricing

# all storage prices are per GB per month.
PRICING = {
    'gcs-standard'     : 0.026,
    'gcs-reduced'      : 0.02,
    'gcs-nearline'     : 0.01,
    'snapshot'         : 0.026,
    'local-ssd'        : 0.218,
    'pd-ssd'           : 0.17,
    'pd-standard'      : 0.04,

    'n1-standard-hour' : 0.055,          # for equivalent of -1, so multiply by number of cpu's (the suffix)
    'n1-standard-pre'  : 0.0165,
    'n1-standard-month': 0.039*30.5*24,  # price for sustained use for a month
    'n1-standard-ram'  : 3.75,           # amount in GB of base machine

    'n1-highmem-hour'  : 0.0695,
    'n1-highmem-pre'   : 0.01925,
    'n1-highmem-month' : 0.0485*30.5*24,
    'n1-highmem-ram'   : 6.5,

    'n1-highcpu-hour'  : 0.042,
    'n1-highcpu-pre'   : 0.011,
    'n1-highcpu-month' : 0.0295*30.5*24,
    'n1-highcpu-ram'   : 0.9,

    'g1-small-hour'    : 0.032,
    'g1-small-pre'     : 0.011,
    'g1-small-month'   : 0.023*30.5*24,
    'g1-small-ram'     : 1.7,

    'f1-micro-hour'    : 0.012,
    'f1-micro-pre'     : 0.0055,
    'f1-micro-month'   : 0.009*30.5*24,
    'f1-micro-ram'     : 0.60,

    'europe'           : 1.096,
    'asia'             : 1.096,
    'us'               : 1,

    'egress'           : 0.12,
    'egress-china'     : 0.23,
    'egress-australia' : 0.19,
}


sys.path.append(os.path.join(os.environ['SALVUS_ROOT'], 'scripts'))
from smc_firewall import log, cmd


class GCE(object):
    def __init__(self):
        self.project = "sage-math-inc"

    def instance_name(self, node, prefix, zone, devel):
        # the zone names have got annoyingly non-canonical...
        if prefix.startswith('smc'):
            zone = "-"+self.expand_zone(zone)
        elif prefix.startswith('compute') or prefix.startswith('storage'):
            zone = "-"+self.short_zone(zone)
        else:
{'fraction_non_alphanumeric': 0.1663615560640732, 'fraction_numerical': 0.07116704805491991, 'mean_word_length': 2.111032028469751, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4707227', 'n_tokens_mistral': 1959, 'n_tokens_neox': 1743, 'n_words': 332}