starcluster.templates.config

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  # number of seconds to wait when polling instances (default: 30s)
     17  #REFRESH_INTERVAL=15
     18  # specify a web browser to launch when viewing spot history plots
     19  #WEB_BROWSER=chromium
     20
     21  [aws info]
     22  # This is the AWS credentials section.
     23  # These settings apply to all clusters
     24  # replace these with your AWS keys
     25  AWS_ACCESS_KEY_ID = #your_aws_access_key_id
     26  AWS_SECRET_ACCESS_KEY = #your_secret_access_key
     27  # replace this with your account number
     28  AWS_USER_ID= #your userid
     29  # Uncomment to specify a different Amazon AWS region  (OPTIONAL)
     30  # (defaults to us-east-1 if not specified)
     31  # NOTE: AMIs have to be migrated!
     32  #AWS_REGION_NAME = eu-west-1
     33  #AWS_REGION_HOST = ec2.eu-west-1.amazonaws.com
     34  # Uncomment these settings when creating an instance-store (S3) AMI (OPTIONAL)
     35  #EC2_CERT = /path/to/your/cert-asdf0as9df092039asdfi02089.pem
     36  #EC2_PRIVATE_KEY = /path/to/your/pk-asdfasd890f200909.pem
     37
     38  # Sections starting with "key" define your keypairs
     39  # (see the EC2 getting started guide tutorial on using ec2-add-keypair to learn
     40  # how to create new keypairs)
     41  # Section name should match your key name e.g.:
     42  [key gsg-keypair]
     43  KEY_LOCATION=/home/myuser/.ssh/id_rsa-gsg-keypair
     44
     45  # You can of course have multiple keypair sections
     46  # [key my-other-gsg-keypair]
     47  # KEY_LOCATION=/home/myuser/.ssh/id_rsa-my-other-gsg-keypair
     48
     49  # Sections starting with "cluster" define your cluster templates
     50  # Section name is the name you give to your cluster template e.g.:
     51  [cluster smallcluster]
     52  # change this to the name of one of the keypair sections defined above
     53  KEYNAME = gsg-keypair
     54
     55  # number of ec2 instances to launch
     56  CLUSTER_SIZE = 2
     57
     58  # create the following user on the cluster
     59  CLUSTER_USER = sgeadmin
     60
     61  # optionally specify shell (defaults to bash)
     62  # (options: %(shells)s)
     63  CLUSTER_SHELL = bash
     64
     65  # AMI for cluster nodes.
     66  # The base i386 StarCluster AMI is %(x86_ami)s
     67  # The base x86_64 StarCluster AMI is %(x86_64_ami)s
     68  NODE_IMAGE_ID = %(x86_ami)s
     69  # instance type for all cluster nodes
     70  # (options: %(instance_types)s)
     71  NODE_INSTANCE_TYPE = m1.small
     72
     73  # Uncomment to disable installing/configuring a queueing system on the
     74  # cluster (SGE)
     75  #DISABLE_QUEUE=True
     76
     77  # Uncomment to specify a different instance type for the master node (OPTIONAL)
     78  # (defaults to NODE_INSTANCE_TYPE if not specified)
     79  #MASTER_INSTANCE_TYPE = m1.small
     80
     81  # Uncomment to specify a separate AMI to use for the master node. (OPTIONAL)
     82  # (defaults to NODE_IMAGE_ID if not specified)
     83  #MASTER_IMAGE_ID = %(x86_ami)s (OPTIONAL)
     84
     85  # availability zone to launch the cluster in (OPTIONAL)
     86  # (automatically determined based on volumes (if any) or
     87  # selected by Amazon if not specified)
     88  #AVAILABILITY_ZONE = us-east-1c
     89
     90  # list of volumes to attach to the master node (OPTIONAL)
     91  # these volumes, if any, will be NFS shared to the worker nodes
     92  # see "Configuring EBS Volumes" below on how to define volume sections
     93  #VOLUMES = oceandata, biodata
     94
     95  # list of plugins to load after StarCluster's default setup routines (OPTIONAL)
     96  # see "Configuring StarCluster Plugins" below on how to define plugin sections
     97  #PLUGINS = myplugin, myplugin2
     98
     99  # list of permissions (or firewall rules) to apply to the cluster's security
    100  # group (OPTIONAL).
    101  #PERMISSIONS = ssh, http
    102
    103  # Uncomment to always create a spot cluster when creating a new cluster from
    104  # this template. The following example will place a $0.50 bid for each spot
    105  # request.
    106  #SPOT_BID = 0.50
    107
    108  ###########################################
    109  ## Defining Additional Cluster Templates ##
    110  ###########################################
    111
    112  # You can also define multiple cluster templates.
    113  # You can either supply all configuration options as with smallcluster above,
    114  # or create an EXTENDS=<cluster_name> variable in the new cluster section to
    115  # use all settings from <cluster_name> as defaults. Below are a couple of
    116  # example cluster templates that use the EXTENDS feature:
    117
    118  # [cluster mediumcluster]
    119  # Declares that this cluster uses smallcluster as defaults
    120  # EXTENDS=smallcluster
    121  # This section is the same as smallcluster except for the following settings:
    122  # KEYNAME=my-other-gsg-keypair
    123  # NODE_INSTANCE_TYPE = c1.xlarge
    124  # CLUSTER_SIZE=8
    125  # VOLUMES = biodata2
    126
    127  # [cluster largecluster]
    128  # Declares that this cluster uses mediumcluster as defaults
    129  # EXTENDS=mediumcluster
    130  # This section is the same as mediumcluster except for the following variables:
    131  # CLUSTER_SIZE=16
    132
    133  #############################
    134  ## Configuring EBS Volumes ##
    135  #############################
    136
    137  # A new [volume] section must be created for each EBS volume you wish to use
    138  # with StarCluser. The section name is a tag for your volume. This tag is used
    139  # in the VOLUMES setting of a cluster template to declare that an EBS volume is
    140  # to be mounted and nfs shared on the cluster. (see the commented VOLUMES
    141  # setting in the example 'smallcluster' template above)
    142  # Below are some examples of defining and configuring EBS volumes to be used
    143  # with StarCluster:
    144
    145  # Sections starting with "volume" define your EBS volumes
    146  # Section name tags your volume e.g.:
    147  # [volume biodata]
    148  # (attach 1st partition of volume vol-c9999999 to /home on master node)
    149  # VOLUME_ID = vol-c999999
    150  # MOUNT_PATH = /home
    151
    152  # Same volume as above, but mounts to different location
    153  # [volume biodata2]
    154  # (attach 1st partition of volume vol-c9999999 to /opt/ on master node)
    155  # VOLUME_ID = vol-c999999
    156  # MOUNT_PATH = /opt/
    157
    158  # Another volume example
    159  # [volume oceandata]
    160  # (attach 1st partition of volume vol-d7777777 to /mydata on master node)
    161  # VOLUME_ID = vol-d7777777
    162  # MOUNT_PATH = /mydata
    163
    164  # Same as oceandata only uses the 2nd partition instead
    165  # [volume oceandata]
    166  # (attach 2nd partition of volume vol-d7777777 to /mydata on master node)
    167  # VOLUME_ID = vol-d7777777
    168  # MOUNT_PATH = /mydata
    169  # PARTITION = 2
    170
    171  #####################################
    172  ## Configuring StarCluster Plugins ##
    173  #####################################
    174
    175  # Sections starting with "plugin" define a custom python class which can
    176  # perform additional configurations to StarCluster's default routines. These
    177  # plugins can be assigned to a cluster template to customize the setup
    178  # procedure when starting a cluster from this template
    179  # (see the commented PLUGINS setting in the 'smallcluster' template above)
    180  # Below is an example of defining a plugin called 'myplugin':
    181
    182  # [plugin myplugin]
    183  # myplugin module either lives in ~/.starcluster/plugins or is
    184  # in your PYTHONPATH
    185  # SETUP_CLASS = myplugin.SetupClass
    186  # extra settings are passed as arguments to your plugin:
    187  # SOME_PARAM_FOR_MY_PLUGIN = 1
    188  # SOME_OTHER_PARAM = 2
    189
    190  ############################################
    191  ## Configuring Security Group Permissions ##
    192  ############################################
    193
    194  # [permission ssh]
    195  # protocol can be: tcp, udp, or icmp
    196  # protocol = tcp
    197  # from_port = 22
    198  # to_port = 22
    199  # cidr_ip = <your_ip>/32
    200
    201  # example for opening port 80 on the cluster to a specific IP range
    202  # [permission http]
    203  # protocol = tcp
    204  # from_port = 80
    205  # to_port = 80
    206  # cidr_ip = 18.0.0.0/24
    207  """ % {
    208      'x86_ami': static.BASE_AMI_32,
    209      'x86_64_ami': static.BASE_AMI_64,
    210      'instance_types': ', '.join(static.INSTANCE_TYPES.keys()),
    211      'shells': ', '.join(static.AVAILABLE_SHELLS.keys()),
    212  }
    213
    214  DASHES = '-' * 10
    215  copy_below = ' '.join([DASHES, 'COPY BELOW THIS LINE', DASHES])
    216  end_copy = ' '.join([DASHES, 'END COPY', DASHES])
    217  copy_paste_template = '\n'.join([copy_below, config_template, end_copy]) + '\n'
    218