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