1
2 """
3 Module for storing static data structures
4 """
5 import os
6 import getpass
7 import tempfile
8
9 VERSION = "0.92rc1"
10 PID = os.getpid()
11 TMP_DIR = tempfile.gettempdir()
12 if os.path.exists("/tmp"):
13 TMP_DIR = "/tmp"
14 CURRENT_USER = 'unknown_user'
15 try:
16 CURRENT_USER = getpass.getuser()
17 except:
18 pass
19 SSH_TEMPLATE = 'ssh -i %s %s@%s'
20 DEBUG_FILE = os.path.join(TMP_DIR, 'starcluster-debug-%s.log' % CURRENT_USER)
21 SSH_DEBUG_FILE = os.path.join(TMP_DIR, 'starcluster-ssh-%s.log' % CURRENT_USER)
22 AWS_DEBUG_FILE = os.path.join(TMP_DIR, 'starcluster-aws-%s.log' % CURRENT_USER)
23
24 STARCLUSTER_CFG_DIR = os.path.join(os.path.expanduser('~'), '.starcluster')
25 STARCLUSTER_CFG_FILE = os.path.join(STARCLUSTER_CFG_DIR, 'config')
26 STARCLUSTER_PLUGIN_DIR = os.path.join(STARCLUSTER_CFG_DIR, 'plugins')
27 STARCLUSTER_RECEIPT_DIR = "/var/run/starcluster"
28 STARCLUSTER_RECEIPT_FILE = os.path.join(STARCLUSTER_RECEIPT_DIR, "receipt.pkl")
29 STARCLUSTER_OWNER_ID = 342652561657
30
31
32 BASE_AMI_32 = "ami-8cf913e5"
33 BASE_AMI_64 = "ami-0af31963"
34
35 SECURITY_GROUP_PREFIX = "@sc"
36 SECURITY_GROUP_TEMPLATE = '-'.join([SECURITY_GROUP_PREFIX, "%s"])
37 MASTER_GROUP_NAME = "masters"
38 MASTER_GROUP = SECURITY_GROUP_TEMPLATE % MASTER_GROUP_NAME
39 MASTER_GROUP_DESCRIPTION = "StarCluster Master Nodes"
40 VOLUME_GROUP_NAME = "volumecreator"
41 VOLUME_GROUP = SECURITY_GROUP_TEMPLATE % VOLUME_GROUP_NAME
42
43 IGNORE_GROUPS = [MASTER_GROUP]
44
45 INSTANCE_STATES = ['pending', 'running', 'shutting-down',
46 'terminated', 'stopping', 'stopped']
47
48 VOLUME_STATUS = ['creating', 'available', 'in-use',
49 'deleting', 'deleted', 'error']
50 VOLUME_ATTACH_STATUS = ['attaching', 'attached', 'detaching', 'detached']
51
52 INSTANCE_TYPES = {
53 't1.micro': ['i386', 'x86_64'],
54 'm1.small': ['i386'],
55 'm1.large': ['x86_64'],
56 'm1.xlarge': ['x86_64'],
57 'c1.medium': ['i386'],
58 'c1.xlarge': ['x86_64'],
59 'm2.xlarge': ['x86_64'],
60 'm2.2xlarge': ['x86_64'],
61 'm2.4xlarge': ['x86_64'],
62 'cc1.4xlarge': ['x86_64'],
63 'cg1.4xlarge': ['x86_64'],
64 }
65
66 MICRO_INSTANCE_TYPES = ['t1.micro']
67
68 CLUSTER_COMPUTE_TYPES = ['cc1.4xlarge']
69
70 CLUSTER_GPU_TYPES = ['cg1.4xlarge']
71
72 CLUSTER_TYPES = CLUSTER_COMPUTE_TYPES + CLUSTER_GPU_TYPES
73
74 PROTOCOLS = ['tcp', 'udp', 'icmp']
75
76 AVAILABLE_SHELLS = {
77 "bash": True,
78 "zsh": True,
79 "csh": True,
80 "ksh": True,
81 "tcsh": True,
82 }
83
84 GLOBAL_SETTINGS = {
85
86 'default_template': (str, False, None, None, None),
87 'enable_experimental': (bool, False, False, None, None),
88 'refresh_interval': (int, False, 30, None, None),
89 }
90
91 AWS_SETTINGS = {
92 'aws_access_key_id': (str, True, None, None, None),
93 'aws_secret_access_key': (str, True, None, None, None),
94 'aws_user_id': (str, False, None, None, None),
95 'ec2_cert': (str, False, None, None, None),
96 'ec2_private_key': (str, False, None, None, None),
97 'aws_port': (int, False, None, None, None),
98 'aws_ec2_path': (str, False, '/', None, None),
99 'aws_s3_path': (str, False, '/', None, None),
100 'aws_is_secure': (bool, False, True, None, None),
101 'aws_region_name': (str, False, None, None, None),
102 'aws_region_host': (str, False, None, None, None),
103 'aws_s3_host': (str, False, None, None, None),
104 }
105
106 KEY_SETTINGS = {
107 'key_location': (str, True, None, None, os.path.expanduser),
108 }
109
110 EBS_VOLUME_SETTINGS = {
111 'volume_id': (str, True, None, None, None),
112 'device': (str, False, None, None, None),
113 'partition': (int, False, None, None, None),
114 'mount_path': (str, True, None, None, None),
115 }
116
117 PLUGIN_SETTINGS = {
118 'setup_class': (str, True, None, None, None),
119 }
120
121 PERMISSION_SETTINGS = {
122
123 'ip_protocol': (str, False, 'tcp', PROTOCOLS, None),
124 'from_port': (int, True, None, None, None),
125 'to_port': (int, True, None, None, None),
126 'cidr_ip': (str, False, '0.0.0.0/0', None, None),
127
128
129
130
131
132
133 }
134
135 CLUSTER_SETTINGS = {
136 'spot_bid': (float, False, None, None, None),
137 'cluster_size': (int, True, None, None, None),
138 'cluster_user': (str, False, 'sgeadmin', None, None),
139 'cluster_shell': (str, False, 'bash', AVAILABLE_SHELLS.keys(), None),
140 'master_image_id': (str, False, None, None, None),
141 'master_instance_type': (str, False, None, INSTANCE_TYPES.keys(), None),
142 'node_image_id': (str, True, None, None, None),
143 'node_instance_type': (list, True, [], None, None),
144 'availability_zone': (str, False, None, None, None),
145 'keyname': (str, True, None, None, None),
146 'extends': (str, False, None, None, None),
147 'volumes': (list, False, [], None, None),
148 'plugins': (list, False, [], None, None),
149 'permissions': (list, False, [], None, None),
150 'disable_queue': (bool, False, False, None, None),
151 }
152