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