~fwereade/pyjuju/fix-cluster-instances

« back to all changes in this revision

Viewing changes to juju/machine/constraints_info.py

  • Committer: William Reade
  • Date: 2012-01-13 15:54:01 UTC
  • Revision ID: fwereade@gmail.com-20120113155401-cjhojx5hgbcmju4z
dead code removal, rearrangement of ec2 info to remove duplication

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from collections import namedtuple
1
2
import operator
2
3
from string import ascii_lowercase
3
4
 
74
75
# We don't have any way to know for sure what zones or instance-types are
75
76
# actually available in the current region, hence not named _"VALID"_EC2_*
76
77
_PLAUSIBLE_EC2_ZONES = ascii_lowercase
 
78
 
 
79
# cost is measured in $/h in us-east-1
 
80
_InstanceType = namedtuple("_InstanceType", "arch cpu mem cost")
 
81
 
 
82
# t1.micro can be i386 or amd64, and this needs special handling; however,
 
83
# it doesn't seem worthwhile to add custom code for handling non-overlap
 
84
# of arch when there's already a mechanism for specifying the desired arch
 
85
# for a t1.micro (cpu=0 mem=0 arch=<whatever>).
 
86
EC2_T1_MICRO_ARCH = "?"
 
87
 
 
88
EC2_INSTANCE_TYPES = {
 
89
    # t1.micro cpu is "up to 2", but in practice "very little"
 
90
    "t1.micro": _InstanceType(EC2_T1_MICRO_ARCH, 0.1, 613, 0.02),
 
91
 
 
92
    "m1.small": _InstanceType("i386", 1, 1740, 0.085),
 
93
    "m1.large": _InstanceType("amd64", 4, 7680, 0.34),
 
94
    "m1.xlarge": _InstanceType("amd64", 8, 15360, 0.68),
 
95
 
 
96
    "m2.xlarge": _InstanceType("amd64", 6.5, 17510, 0.5),
 
97
    "m2.2xlarge": _InstanceType("amd64", 13, 35020, 1),
 
98
    "m2.4xlarge": _InstanceType("amd64", 26, 70040, 2),
 
99
 
 
100
    "c1.medium": _InstanceType("i386", 5, 1740, 0.17),
 
101
    "c1.xlarge": _InstanceType("amd64", 20, 7168, 0.68),
 
102
 
 
103
    "cc1.4xlarge": _InstanceType("amd64", 33.5, 23552, 1.3),
 
104
    "cc2.8xlarge": _InstanceType("amd64", 88, 61952, 2.4),
 
105
 
 
106
    # also has fancy GPUs we can't currently describe
 
107
    "cg1.4xlarge": _InstanceType("amd64", 33.5, 22528, 2.1)}
 
108
 
77
109
_PLAUSIBLE_EC2_INSTANCE_TYPES = (
78
110
    "t1.micro", "m1.small", "m1.large", "m1.xlarge", "m2.xlarge", "m2.2xlarge",
79
111
    "m2.4xlarge", "c1.medium", "c1.xlarge", "cc1.4xlarge", "cc1.8xlarge",