Package starcluster :: Package templates :: Module config
[hide private]
[frames] | no frames]

Source Code for Module starcluster.templates.config

  1  #!/usr/bin/env python 
  2  from starcluster import static 
  3   
  4  config_template = """ 
  5  #################################### 
  6  ## StarCluster Configuration File ## 
  7  #################################### 
  8   
  9  [global] 
 10  # configure the default cluster template to use when starting a cluster 
 11  # defaults to 'smallcluster' defined below. this template should be usable 
 12  # out-of-the-box provided you've configured your keypair correctly 
 13  DEFAULT_TEMPLATE=smallcluster 
 14  # enable experimental features for this release 
 15  ENABLE_EXPERIMENTAL=False 
 16   
 17  [aws info] 
 18  # This is the AWS credentials section. 
 19  # These settings apply to all clusters 
 20  # replace these with your AWS keys 
 21  AWS_ACCESS_KEY_ID = #your_aws_access_key_id 
 22  AWS_SECRET_ACCESS_KEY = #your_secret_access_key 
 23  # replace this with your account number 
 24  AWS_USER_ID= #your userid 
 25   
 26  # Sections starting with "key" define your keypairs 
 27  # (see the EC2 getting started guide tutorial on using ec2-add-keypair to learn 
 28  # how to create new keypairs) 
 29  # Section name should match your key name e.g.: 
 30  [key gsg-keypair] 
 31  KEY_LOCATION=/home/myuser/.ssh/id_rsa-gsg-keypair 
 32   
 33  # You can of course have multiple keypair sections 
 34  # [key my-other-gsg-keypair] 
 35  # KEY_LOCATION=/home/myuser/.ssh/id_rsa-my-other-gsg-keypair 
 36   
 37  # Sections starting with "cluster" define your cluster templates 
 38  # Section name is the name you give to your cluster template e.g.: 
 39  [cluster smallcluster] 
 40  # change this to the name of one of the keypair sections defined above  
 41  KEYNAME = gsg-keypair 
 42   
 43  # number of ec2 instances to launch 
 44  CLUSTER_SIZE = 2 
 45   
 46  # create the following user on the cluster 
 47  CLUSTER_USER = sgeadmin 
 48   
 49  # optionally specify shell (defaults to bash) 
 50  # (options: %(shells)s) 
 51  CLUSTER_SHELL = bash 
 52   
 53  # AMI for cluster nodes. 
 54  # The base i386 StarCluster AMI is %(x86_ami)s 
 55  # The base x86_64 StarCluster AMI is %(x86_64_ami)s 
 56  NODE_IMAGE_ID = %(x86_ami)s 
 57  # instance type for all cluster nodes  
 58  # (options: %(instance_types)s) 
 59  NODE_INSTANCE_TYPE = m1.small 
 60   
 61  # Uncomment to specify a different instance type for the master node  (OPTIONAL) 
 62  # (defaults to NODE_INSTANCE_TYPE if not specified) 
 63  #MASTER_INSTANCE_TYPE = m1.small 
 64   
 65  # Uncomment to specify a separate AMI to use for the master node. (OPTIONAL) 
 66  # (defaults to NODE_IMAGE_ID if not specified) 
 67  #MASTER_IMAGE_ID = %(x86_ami)s (OPTIONAL) 
 68   
 69  # availability zone to launch the cluster in (OPTIONAL) 
 70  # (automatically determined based on volumes (if any) or  
 71  # selected by Amazon if not specified) 
 72  #AVAILABILITY_ZONE = us-east-1c 
 73   
 74  # list of volumes to attach to the master node and nfs share to worker nodes (OPTIONAL) 
 75  # (see "Configuring EBS Volumes" below for an example of defining volume sections) 
 76  #VOLUMES = oceandata, biodata 
 77   
 78  # list of plugins to load after StarCluster's default setup routines (OPTIONAL) 
 79  # (see "Configuring StarCluster Plugins" below for an example of defining a plugin section) 
 80  #PLUGINS = myplugin, myplugin2 
 81   
 82  ########################################### 
 83  ## Defining Additional Cluster Templates ## 
 84  ########################################### 
 85   
 86  # You can also define multiple cluster templates. 
 87  # You can either supply all configuration options as with smallcluster above, or 
 88  # create an EXTENDS=<cluster_name> variable in the new cluster section to use all  
 89  # settings from <cluster_name> as defaults. Below are a couple of example 
 90  # cluster templates that use the EXTENDS feature: 
 91   
 92  # [cluster mediumcluster] 
 93  # Declares that this cluster uses smallcluster as defaults 
 94  # EXTENDS=smallcluster 
 95  # This section is the same as smallcluster except for the following settings: 
 96  # KEYNAME=my-other-gsg-keypair 
 97  # NODE_INSTANCE_TYPE = c1.xlarge 
 98  # CLUSTER_SIZE=8 
 99  # VOLUMES = biodata2 
100   
101  # [cluster largecluster] 
102  # Declares that this cluster uses mediumcluster as defaults 
103  # EXTENDS=mediumcluster 
104  # This section is the same as mediumcluster except for the following variables: 
105  # CLUSTER_SIZE=16 
106   
107  ############################# 
108  ## Configuring EBS Volumes ## 
109  ############################# 
110   
111  # Using EBS volumes with StarCluster is relatively straight forward. You create 
112  # a [volume] section that represents an EBS volume. The section name is a tag 
113  # for your volume. This tag is used in the VOLUMES setting in a cluster template  
114  # to declare that an EBS volume is to be mounted and nfs shared on the cluster. 
115  # (see the commented VOLUMES setting in the 'smallcluster' template above) 
116  # Below are some examples of defining and configuring EBS volumes to be used 
117  # with StarCluster: 
118   
119  # Sections starting with "volume" define your EBS volumes 
120  # Section name tags your volume e.g.: 
121  # [volume biodata] 
122  # (attach 1st partition of volume vol-c9999999 to /home on master node) 
123  # VOLUME_ID = vol-c999999 
124  # MOUNT_PATH = /home 
125   
126  # Same volume as above, but mounts to different location 
127  # [volume biodata2] 
128  # (attach 1st partition of volume vol-c9999999 to /opt/ on master node) 
129  # VOLUME_ID = vol-c999999 
130  # MOUNT_PATH = /opt/ 
131   
132  # Another volume example  
133  # [volume oceandata] 
134  # (attach 1st partition of volume vol-d7777777 to /mydata on master node) 
135  # VOLUME_ID = vol-d7777777 
136  # MOUNT_PATH = /mydata 
137   
138  # Same as oceandata only uses the 2nd partition instead 
139  # [volume oceandata] 
140  # (attach 2nd partition of volume vol-d7777777 to /mydata on master node) 
141  # VOLUME_ID = vol-d7777777 
142  # MOUNT_PATH = /mydata 
143  # PARTITION = 2 
144   
145  ##################################### 
146  ## Configuring StarCluster Plugins ## 
147  ##################################### 
148   
149  # Sections starting with "plugin" define a custom python class 
150  # which can perform additional configurations to StarCluster's default routines. These plugins  
151  # can be assigned to a cluster template to customize the setup procedure when 
152  # starting a cluster from this template 
153  # (see the commented PLUGINS setting in the 'smallcluster' template above)  
154  # Below is an example of defining a plugin called 'myplugin': 
155   
156  # [plugin myplugin] 
157  # myplugin module either lives in ~/.starcluster/plugins or is  
158  # in your PYTHONPATH 
159  # SETUP_CLASS = myplugin.SetupClass 
160  # extra settings are passed as arguments to your plugin: 
161  # SOME_PARAM_FOR_MY_PLUGIN = 1 
162  # SOME_OTHER_PARAM = 2 
163   
164  """ % { 
165      'x86_ami': static.BASE_AMI_32, 
166      'x86_64_ami': static.BASE_AMI_64, 
167      'instance_types': ', '.join(static.INSTANCE_TYPES.keys()), 
168      'shells': ', '.join(static.AVAILABLE_SHELLS.keys()), 
169  } 
170   
171  DASHES='-'*10 
172  copy_paste_template=DASHES + ' COPY BELOW THIS LINE ' + DASHES  + \ 
173      '\n' + config_template + '\n' + DASHES + ' END COPY ' + DASHES + '\n' 
174