diff --git a/.travis.yml b/.travis.yml index 8d6c95434a..37e0c314ad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,7 +24,10 @@ install: sudo: false script: - - if [[ $TRAVIS_PYTHON_VERSION != 2.6 ]]; - then python cli/tests/cfncluster-unittest.py; + - if [[ $TRAVIS_PYTHON_VERSION != 2.6 ]]; then + pip install 'boto3==1.7.84' --force-reinstall; + pip install moto + python cli/tests/cfncluster-unittest.py; + pip install boto3 --upgrade; fi - sh tests/test.sh diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 22b96cad72..e36318f05d 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,6 +2,13 @@ CHANGELOG ========= +1.5.4 +===== +* Add option to disable ganglia `extra_json = { "cfncluster" : { "ganglia_enabled" : "no" } }` +* Fix `cfncluster update` bug +* Set SGE Accounting summary to be true, this reports a single accounting record for a mpi job +* Upgrade cfncluster-node to Boto3 + 1.5.3 ===== * Add support for GovCloud, us-gov-west-1 region diff --git a/README.rst b/README.rst index 8453202152..48e236d0f0 100644 --- a/README.rst +++ b/README.rst @@ -28,6 +28,11 @@ Please open a GitHub issue for any feedback or issues: https://github.com/awslabs/cfncluster. There is also an active AWS HPC forum which may be helpful:https://forums.aws.amazon.com/forum.jspa?forumID=192. +CfnCluster 1.6 IAM Change +========================= +Between CfnCluster 1.5.3 and 1.6.0 we made a change to the CfnClusterInstancePolicy that adds “s3:GetObject” permissions on objects in -cfncluster bucket. +If you’re using a custom policy (e.g. you specify "ec2_iam_role" in your config) be sure it includes this new permission. See https://cfncluster.readthedocs.io/en/latest/iam.html + CfnCluster 1.5 IAM Change ========================= Between CfnCluster 1.4.2 and 1.5.0 we made a change to the CfnClusterInstancePolicy that adds “ec2:DescribeVolumes” permissions. If you’re using a custom policy (e.g. you specify "ec2_iam_role" in your config) be sure it includes this new permission. See https://cfncluster.readthedocs.io/en/latest/iam.html diff --git a/amis.txt b/amis.txt index a54288c050..48ff4df4db 100644 --- a/amis.txt +++ b/amis.txt @@ -1,88 +1,88 @@ # alinux -ap-northeast-1: ami-05468a90639fdc483 -ap-northeast-2: ami-0b4d5a4a999581db1 -ap-northeast-3: ami-0594d5d373771f10a -ap-south-1: ami-0ec7be770210af7c0 -ap-southeast-1: ami-02181eb4bbe285f28 -ap-southeast-2: ami-03199596cd474bb05 -ca-central-1: ami-099a5f4b65d56215e -eu-central-1: ami-00e39ce170dbd6e25 -eu-west-1: ami-059b3db381c18305a -eu-west-2: ami-0df738bfb4cf98f4e -eu-west-3: ami-0b1472bf5fed029bd -sa-east-1: ami-0a390e1998fb6b22f -us-east-1: ami-0fd6854902340b407 -us-east-2: ami-04fc90a3f60cb3dc7 -us-gov-west-1: ami-af2cbece -us-west-1: ami-0054acc8361046ccc -us-west-2: ami-01382f63e2667a7d1 +ap-northeast-1: ami-00047986f877e6760 +ap-northeast-2: ami-0ca5afbc9d0b20f3d +ap-northeast-3: ami-0b3af1c2fe35b1ae4 +ap-south-1: ami-0250a8315b099785d +ap-southeast-1: ami-038312aa862774599 +ap-southeast-2: ami-0dce078cd2c343a5c +ca-central-1: ami-04e27bd54e171fbad +eu-central-1: ami-075bf1c36cf6b855f +eu-west-1: ami-08d507a759b9ee0e4 +eu-west-2: ami-03ddfb1462e2c92fd +eu-west-3: ami-0e72015cf2b21159f +sa-east-1: ami-02bd755bfe8704cef +us-east-1: ami-07f61c3e18538c70c +us-east-2: ami-096b7925b1f9c8cbb +us-gov-west-1: ami-cfd34dae +us-west-1: ami-04794da830cb9dc86 +us-west-2: ami-03f86a2920360dfbe # centos6 -ap-northeast-1: ami-0603daa665c23cf74 -ap-northeast-2: ami-06ddec14c10c7de14 -ap-northeast-3: ami-0e718e0794e781ead -ap-south-1: ami-043871a624a63c4b3 -ap-southeast-1: ami-07df16800a8f39379 -ap-southeast-2: ami-09b23d993fbc703d9 -ca-central-1: ami-0af06655a7341c2b5 -eu-central-1: ami-0362d5eb8ec477a30 -eu-west-1: ami-04c68c9303ee0165c -eu-west-2: ami-0d3a080fd047d6f03 -eu-west-3: ami-0ce8fcafcd4cb66ba -sa-east-1: ami-010873231de6443db -us-east-1: ami-0051f4828527649d0 -us-east-2: ami-0a585da16a01304bb -us-west-1: ami-0fcbc3afb66cfcffd -us-west-2: ami-0430c74956ce8e41a +ap-northeast-1: ami-00c9ad360d255b462 +ap-northeast-2: ami-08e84ffe9aead7873 +ap-northeast-3: ami-056531169587ffc23 +ap-south-1: ami-03a57d339b58b2f23 +ap-southeast-1: ami-00063e5635939c9d1 +ap-southeast-2: ami-015e730525001bf53 +ca-central-1: ami-0fea713db092ac77f +eu-central-1: ami-0f6b91d011f44aaf6 +eu-west-1: ami-029accac823a2a844 +eu-west-2: ami-032b6b895dab544c6 +eu-west-3: ami-039be4bd46c878e2c +sa-east-1: ami-0e507bdec09b8a091 +us-east-1: ami-091bbc83b27f92634 +us-east-2: ami-0fa89e68b0222f50b +us-west-1: ami-06f3909be633646b9 +us-west-2: ami-087d4f29315fd19d2 # centos7 -ap-northeast-1: ami-03e99430742e7d834 -ap-northeast-2: ami-0a3ad3da5f45318a4 -ap-northeast-3: ami-0804a0d2dcf1e675f -ap-south-1: ami-06b1a64ab30690802 -ap-southeast-1: ami-06eec4db7a3965f04 -ap-southeast-2: ami-0ab1def1c27a54ada -ca-central-1: ami-089b3d6d4ef8c5772 -eu-central-1: ami-0842b79de396801b5 -eu-west-1: ami-019ecc5629a990951 -eu-west-2: ami-03e914c8e1b836bcf -eu-west-3: ami-099b3883ce5e219b3 -sa-east-1: ami-0edbfab1cbd73ac82 -us-east-1: ami-00976a3c38aaac1a2 -us-east-2: ami-0f7dbb8d94e96b0ab -us-west-1: ami-0fae379328b9061bc -us-west-2: ami-0df85f5bc2d980e57 +ap-northeast-1: ami-09dc3b175ed2905f8 +ap-northeast-2: ami-03f494fed9f0f9c98 +ap-northeast-3: ami-04094dd3b4013b75f +ap-south-1: ami-0c20297a2c00b0528 +ap-southeast-1: ami-0f610508513f2012f +ap-southeast-2: ami-09d0b89439c0c1b65 +ca-central-1: ami-0362a3ef26ab5dfce +eu-central-1: ami-03d5519f5f4e7619f +eu-west-1: ami-0575304add4986551 +eu-west-2: ami-08263362b21b98916 +eu-west-3: ami-0befb803ea7ce1b83 +sa-east-1: ami-0860c11596f954bbc +us-east-1: ami-06c93be112f880acd +us-east-2: ami-0493261a1b2adfd27 +us-west-1: ami-0af95249ebb8de7a5 +us-west-2: ami-0a259cf8220fabdcb # ubuntu1404 -ap-northeast-1: ami-068214c5cfb518070 -ap-northeast-2: ami-0d55e5524b8536518 -ap-northeast-3: ami-0ad3400658fbc51fa -ap-south-1: ami-0b54a1bd3d82929e6 -ap-southeast-1: ami-0d3382bea35764ad2 -ap-southeast-2: ami-0a2a8aa487ce39e8c -ca-central-1: ami-0bc510154aa82211d -eu-central-1: ami-0174c3f5501fc441b -eu-west-1: ami-01848c6ae1a9c6460 -eu-west-2: ami-0b867b5579d0f7a08 -eu-west-3: ami-0e8f93d19635c5d49 -sa-east-1: ami-048422e42509a1596 -us-east-1: ami-0ba2fcbf9fa378762 -us-east-2: ami-05aea9ea89d577194 -us-gov-west-1: ami-4aca572b -us-west-1: ami-0089ace30f2612d13 -us-west-2: ami-06142a55749b7912b +ap-northeast-1: ami-09dc9e9da730c0248 +ap-northeast-2: ami-06346bcc8b825a458 +ap-northeast-3: ami-0ae6e02016436404a +ap-south-1: ami-0e4294a5b9d5de425 +ap-southeast-1: ami-01e6359021e3bac23 +ap-southeast-2: ami-0cfebd51a3470f1d4 +ca-central-1: ami-0097472502a04776d +eu-central-1: ami-0a82ac2872821deef +eu-west-1: ami-0d6c90f092266b787 +eu-west-2: ami-0f23dffc4db122b53 +eu-west-3: ami-02b6ca8fd14f58265 +sa-east-1: ami-04e943b561cd32659 +us-east-1: ami-0920fa86d5a85a07a +us-east-2: ami-0d63a602f26709e70 +us-gov-west-1: ami-c2d34da3 +us-west-1: ami-06fe4f837d8715dbb +us-west-2: ami-01170828a21d86a72 # ubuntu1604 -ap-northeast-1: ami-03f6879ede5f51a6f -ap-northeast-2: ami-0036ef722f2d0a331 -ap-northeast-3: ami-0a8db47e6bc6f585b -ap-south-1: ami-08870f6ce8227e90f -ap-southeast-1: ami-04950204e84f8bf64 -ap-southeast-2: ami-02b4175018a85c03d -ca-central-1: ami-04a4a63323b55af6e -eu-central-1: ami-089e9903d9c3bee1b -eu-west-1: ami-033b9190bab9d42aa -eu-west-2: ami-049d2247a1c3d582c -eu-west-3: ami-09c4322a65746f77b -sa-east-1: ami-0740b75b4caaa3b77 -us-east-1: ami-05790a6a634720a0d -us-east-2: ami-0a0fcd1219e40a8f5 -us-gov-west-1: ami-3dc8555c -us-west-1: ami-056472d51cf2fed45 -us-west-2: ami-0702d59e57ada76b8 +ap-northeast-1: ami-0b0bf645cde38fe52 +ap-northeast-2: ami-0b2c6c9e988689d7c +ap-northeast-3: ami-0dae0e941e3bce10b +ap-south-1: ami-011d655005fe854e9 +ap-southeast-1: ami-03428422e2cb20c9f +ap-southeast-2: ami-0bbef9e2b1170757f +ca-central-1: ami-0916119fde83c29b7 +eu-central-1: ami-003273c4072efbe43 +eu-west-1: ami-009af0d819973e1d6 +eu-west-2: ami-029f01bbfec52a10e +eu-west-3: ami-0ae405adcb3d1477c +sa-east-1: ami-0b0057ecd5c465d09 +us-east-1: ami-0dfb1662fcc845c55 +us-east-2: ami-01bd1361428c384c3 +us-gov-west-1: ami-0fd6486e +us-west-1: ami-0e144dd24634766a2 +us-west-2: ami-02087bf0ff99cc127 diff --git a/cli/README b/cli/README index 532284b6ab..39045ca349 100644 --- a/cli/README +++ b/cli/README @@ -1,26 +1,27 @@ cfncluster is an example framework for launching clusters. - usage: cfncluster [-h] [--config CONFIG_FILE] [--region REGION] [--nowait] - {create,update,delete,status,list,instances,version} + usage: cfncluster [-h] + {create,update,delete,start,stop,status,list,instances,ssh,configure,version} ... - cfncluster is the a tool to launch and manage cluster. + cfncluster is a tool to launch and manage a cluster. positional arguments: - {create,update,stop,delete,status,list,instances,sshmaster} + {create,update,delete,start,stop,status,list,instances,ssh,configure,version} create creates a cluster update update a running cluster delete delete a cluster + start start the compute fleet that has been stopped + stop stop the compute fleet, but leave the master server + running for debugging/development status pull the current status of the cluster list display a list of stacks associated with cfncluster instances display a list of all instances in a cluster - version display the version of cfncluster cli + ssh connect to the master server using SSH + configure creating initial cfncluster configuration + version display version of cfncluster optional arguments: -h, --help show this help message and exit - --config CONFIG_FILE, -c CONFIG_FILE - specify a alternative config file - --region REGION, -r REGION - specify a specific region to connect to - --nowait, -nw do not wait for stack events, after executing stack - command + + For command specific flags run cfncluster [command] --help diff --git a/cli/cfncluster/cfncluster.py b/cli/cfncluster/cfncluster.py index 87ade9a747..32c0df2cd6 100644 --- a/cli/cfncluster/cfncluster.py +++ b/cli/cfncluster/cfncluster.py @@ -16,6 +16,7 @@ import logging import boto3 import os +import json from botocore.exceptions import ClientError from . import cfnconfig @@ -103,7 +104,10 @@ def create(args): event.get('ResourceStatusReason'))) logger.info('') outputs = cfn.describe_stacks(StackName=stack_name).get("Stacks")[0].get('Outputs', []) + ganglia_enabled = is_ganglia_enabled(config.parameters) for output in outputs: + if not ganglia_enabled and output.get('OutputKey').startswith('Ganglia'): + continue logger.info("%s: %s" % (output.get('OutputKey'), output.get('OutputValue'))) else: status = cfn.describe_stacks(StackName=stack_name).get("Stacks")[0].get('StackStatus') @@ -119,6 +123,14 @@ def create(args): logger.critical(e) sys.exit(1) +def is_ganglia_enabled(parameters): + extra_json = dict(filter(lambda x: x[0] == 'ExtraJson', parameters)) + try: + extra_json = json.loads(extra_json.get('ExtraJson')).get('cfncluster') + return extra_json.get('ganglia_enabled') == 'yes' + except: + pass + return False def update(args): logger.info('Updating: %s' % (args.cluster_name)) @@ -139,7 +151,7 @@ def update(args): desired_capacity = asg.describe_auto_scaling_groups(AutoScalingGroupNames=[asg_name])\ .get('AutoScalingGroups')[0]\ .get('DesiredCapacity') - config.parameters.append(('InitialQueueSize', desired_capacity)) + config.parameters.append(('InitialQueueSize', str(desired_capacity))) # Get the MasterSubnetId and use it to determine AvailabilityZone try: @@ -162,7 +174,7 @@ def update(args): try: logger.debug((config.template_url, config.parameters)) - cfn_params = [{'ParameterKey': param[0], 'ParameterValue': str(param[1])} for param in config.parameters] + cfn_params = [{'ParameterKey': param[0], 'ParameterValue': param[1]} for param in config.parameters] cfn.update_stack(StackName=stack_name,TemplateURL=config.template_url, Parameters=cfn_params, Capabilities=capabilities) status = cfn.describe_stacks(StackName=stack_name).get("Stacks")[0].get('StackStatus') diff --git a/cli/cfncluster/cli.py b/cli/cfncluster/cli.py index d26fa53d2c..aadbf944db 100644 --- a/cli/cfncluster/cli.py +++ b/cli/cfncluster/cli.py @@ -141,17 +141,17 @@ def main(): addarg_nowait(pdelete) pdelete.set_defaults(func=delete) - pstart = subparsers.add_parser('start', help='start the compute-fleet that has been stopped') + pstart = subparsers.add_parser('start', help='start the compute fleet that has been stopped') pstart.add_argument("cluster_name", type=str, default=None, - help='starts the compute-fleet of the provided cluster name.') + help='starts the compute fleet of the provided cluster name.') addarg_config(pstart) addarg_region(pstart) pstart.set_defaults(func=start) - pstop = subparsers.add_parser('stop', help='stop the compute-fleet, but leave the MasterServer running for ' + pstop = subparsers.add_parser('stop', help='stop the compute fleet, but leave the master server running for ' 'debugging/development') pstop.add_argument("cluster_name", type=str, default=None, - help='stops the compute-fleet of the provided cluster name.') + help='stops the compute fleet of the provided cluster name.') addarg_config(pstop) addarg_region(pstop) pstop.set_defaults(func=stop) @@ -176,6 +176,16 @@ def main(): addarg_region(pinstances) pinstances.set_defaults(func=instances) + pssh = subparsers.add_parser('ssh', help='connect to the master server using SSH', + description='run ssh command with username and ip address pre-filled. ' \ + 'Arbitrary arguments are appended to the end of the ssh commmand. ' \ + 'This command may be customized in the aliases section of the config file.') + pssh.add_argument("cluster_name", type=str, default=None, + help='name of the cluster to set variables for.') + pssh.add_argument("--dryrun", "-d", action='store_true', dest="dryrun", default=False, + help='print command and exit.') + pssh.set_defaults(func=command) + pconfigure = subparsers.add_parser('configure', help='creating initial cfncluster configuration') addarg_config(pconfigure) pconfigure.set_defaults(func=configure) @@ -183,15 +193,6 @@ def main(): pversion = subparsers.add_parser('version', help='display version of cfncluster') pversion.set_defaults(func=version) - pssh = subparsers.add_parser('ssh', description='run ssh command with username and ip address pre-filled. ' \ - 'Arbitrary arguments are appended to the end of the ssh commmand. ' \ - 'This command may be customized in the aliases section of the config file.') - pssh.add_argument("cluster_name", type=str, default=None, - help='name of the cluster to set variables for.') - pssh.add_argument("--dryrun", "-d", action='store_true', dest="dryrun", default=False, - help='print command and exit.') - pssh.set_defaults(func=command) - args, extra_args = parser.parse_known_args() logger.debug(args) if args.func.__name__ == 'command': diff --git a/cli/cfncluster/config_sanity.py b/cli/cfncluster/config_sanity.py index 7987ec470b..cdb1af66a8 100644 --- a/cli/cfncluster/config_sanity.py +++ b/cli/cfncluster/config_sanity.py @@ -40,7 +40,9 @@ def check_resource(region, aws_access_key_id, aws_secret_access_key, resource_ty aws_secret_access_key=aws_secret_access_key) arn = iam.get_role(RoleName=resource_value).get('Role').get('Arn') - accountid = boto3.client('sts').get_caller_identity().get('Account') + accountid = boto3.client('sts', region_name=region, + aws_access_key_id=aws_access_key_id, + aws_secret_access_key=aws_secret_access_key).get_caller_identity().get('Account') iam_policy = [(['ec2:DescribeVolumes', 'ec2:AttachVolume', 'ec2:DescribeInstanceAttribute', 'ec2:DescribeInstanceStatus', 'ec2:DescribeInstances'], "*"), (['dynamodb:ListTables'], "*"), @@ -48,6 +50,7 @@ def check_resource(region, aws_access_key_id, aws_secret_access_key, resource_ty (['autoscaling:DescribeAutoScalingGroups', 'autoscaling:TerminateInstanceInAutoScalingGroup', 'autoscaling:SetDesiredCapacity'], "*"), (['cloudwatch:PutMetricData'], "*"), (['dynamodb:PutItem', 'dynamodb:Query', 'dynamodb:GetItem', 'dynamodb:DeleteItem', 'dynamodb:DescribeTable'], "arn:aws:dynamodb:%s:%s:table/cfncluster-*" % (region, accountid)), + (['s3:GetObject'], "arn:aws:s3:::%s-cfncluster/*" % region), (['sqs:ListQueues'], "*"), (['logs:*'], "arn:aws:logs:*:*:*")] diff --git a/cli/cfncluster/easyconfig.py b/cli/cfncluster/easyconfig.py index 61edbc6989..49f42716ed 100644 --- a/cli/cfncluster/easyconfig.py +++ b/cli/cfncluster/easyconfig.py @@ -27,7 +27,7 @@ logger = logging.getLogger('cfncluster.cfncluster') unsupported_regions = ['ap-northeast-3', 'cn-north-1', 'cn-northwest-1'] -def prompt(prompt, default_value=None, hidden=False, options=None): +def prompt(prompt, default_value=None, hidden=False, options=None, check_validity=False): if hidden and default_value is not None: user_prompt = prompt + ' [*******' + default_value[-4:] + ']: ' else: @@ -42,12 +42,17 @@ def prompt(prompt, default_value=None, hidden=False, options=None): for o in options: print(' %s' % o) - var = input(user_prompt) + var = input(user_prompt).strip() if var == '': return default_value else: - return var.strip() + if check_validity and options is not None and var not in options: + print('ERROR: The value (%s) is not valid ' % var) + print('Please select one of the Acceptable Values listed above.') + sys.exit(1) + else: + return var def get_regions(): ec2 = boto3.client('ec2') @@ -130,13 +135,13 @@ def configure(args): aws_secret_access_key = prompt('AWS Secret Access Key ID', config.get('aws', 'aws_secret_access_key') if config.has_option('aws', 'aws_secret_access_key') else None, True) # Use built in boto regions as an available option - aws_region_name = prompt('AWS Region ID', config.get('aws', 'aws_region_name') if config.has_option('aws', 'aws_region_name') else None, options=get_regions()) + aws_region_name = prompt('AWS Region ID', config.get('aws', 'aws_region_name') if config.has_option('aws', 'aws_region_name') else None, options=get_regions(), check_validity=True) vpcname = prompt('VPC Name', config.get('cluster ' + cluster_template, 'vpc_settings') if config.has_option('cluster ' + cluster_template, 'vpc_settings') else 'public') # Query EC2 for available keys as options - key_name = prompt('Key Name', config.get('cluster ' + cluster_template, 'key_name') if config.has_option('cluster ' + cluster_template, 'key_name') else None, options=list_keys(aws_access_key_id, aws_secret_access_key, aws_region_name)) - vpc_id = prompt('VPC ID', config.get('vpc ' + vpcname, 'vpc_id') if config.has_option('vpc ' + vpcname, 'vpc_id') else None, options=list_vpcs(aws_access_key_id, aws_secret_access_key, aws_region_name)) - master_subnet_id = prompt('Master Subnet ID', config.get('vpc ' + vpcname, 'master_subnet_id') if config.has_option('vpc ' + vpcname, 'master_subnet_id') else None, options=list_subnets(aws_access_key_id, aws_secret_access_key, aws_region_name, vpc_id)) + key_name = prompt('Key Name', config.get('cluster ' + cluster_template, 'key_name') if config.has_option('cluster ' + cluster_template, 'key_name') else None, options=list_keys(aws_access_key_id, aws_secret_access_key, aws_region_name), check_validity=True) + vpc_id = prompt('VPC ID', config.get('vpc ' + vpcname, 'vpc_id') if config.has_option('vpc ' + vpcname, 'vpc_id') else None, options=list_vpcs(aws_access_key_id, aws_secret_access_key, aws_region_name), check_validity=True) + master_subnet_id = prompt('Master Subnet ID', config.get('vpc ' + vpcname, 'master_subnet_id') if config.has_option('vpc ' + vpcname, 'master_subnet_id') else None, options=list_subnets(aws_access_key_id, aws_secret_access_key, aws_region_name, vpc_id), check_validity=True) # Dictionary of values we want to set s_global = { '__name__': 'global', 'cluster_template': cluster_template, 'update_check': 'true', 'sanity_check': 'true' } diff --git a/cli/requirements.txt b/cli/requirements.txt index 648439aaa2..57d3af4c34 100644 --- a/cli/requirements.txt +++ b/cli/requirements.txt @@ -1,2 +1 @@ boto3>=1.7.33 -moto>=1.3.3 diff --git a/cli/requirements26.txt b/cli/requirements26.txt index c4b36252af..155bd149c6 100644 --- a/cli/requirements26.txt +++ b/cli/requirements26.txt @@ -1,3 +1,2 @@ boto3>=1.7.33 -argparse>=1.1 -moto>=1.3.3 \ No newline at end of file +argparse>=1.1 \ No newline at end of file diff --git a/cli/setup.py b/cli/setup.py index 1c6475cc0e..2bfa4a297d 100644 --- a/cli/setup.py +++ b/cli/setup.py @@ -20,7 +20,7 @@ def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() console_scripts = ['cfncluster = cfncluster.cli:main'] -version = "1.5.3" +version = "1.5.4" requires = ['boto3>=1.7.33', 'awscli>=1.11.175', 'future>=0.16.0'] if sys.version_info[:2] == (2, 6): diff --git a/cloudformation/cfncluster.cfn.json b/cloudformation/cfncluster.cfn.json index c98c9b8be0..25a74eda8c 100644 --- a/cloudformation/cfncluster.cfn.json +++ b/cloudformation/cfncluster.cfn.json @@ -1631,121 +1631,121 @@ "Mappings": { "AWSRegionOS2AMI": { "ap-northeast-1": { - "alinux": "ami-05468a90639fdc483", - "centos6": "ami-0603daa665c23cf74", - "centos7": "ami-03e99430742e7d834", - "ubuntu1404": "ami-068214c5cfb518070", - "ubuntu1604": "ami-03f6879ede5f51a6f" + "alinux": "ami-00047986f877e6760", + "centos6": "ami-00c9ad360d255b462", + "centos7": "ami-09dc3b175ed2905f8", + "ubuntu1404": "ami-09dc9e9da730c0248", + "ubuntu1604": "ami-0b0bf645cde38fe52" }, "ap-northeast-2": { - "alinux": "ami-0b4d5a4a999581db1", - "centos6": "ami-06ddec14c10c7de14", - "centos7": "ami-0a3ad3da5f45318a4", - "ubuntu1404": "ami-0d55e5524b8536518", - "ubuntu1604": "ami-0036ef722f2d0a331" + "alinux": "ami-0ca5afbc9d0b20f3d", + "centos6": "ami-08e84ffe9aead7873", + "centos7": "ami-03f494fed9f0f9c98", + "ubuntu1404": "ami-06346bcc8b825a458", + "ubuntu1604": "ami-0b2c6c9e988689d7c" }, "ap-northeast-3": { - "alinux": "ami-0594d5d373771f10a", - "centos6": "ami-0e718e0794e781ead", - "centos7": "ami-0804a0d2dcf1e675f", - "ubuntu1404": "ami-0ad3400658fbc51fa", - "ubuntu1604": "ami-0a8db47e6bc6f585b" + "alinux": "ami-0b3af1c2fe35b1ae4", + "centos6": "ami-056531169587ffc23", + "centos7": "ami-04094dd3b4013b75f", + "ubuntu1404": "ami-0ae6e02016436404a", + "ubuntu1604": "ami-0dae0e941e3bce10b" }, "ap-south-1": { - "alinux": "ami-0ec7be770210af7c0", - "centos6": "ami-043871a624a63c4b3", - "centos7": "ami-06b1a64ab30690802", - "ubuntu1404": "ami-0b54a1bd3d82929e6", - "ubuntu1604": "ami-08870f6ce8227e90f" + "alinux": "ami-0250a8315b099785d", + "centos6": "ami-03a57d339b58b2f23", + "centos7": "ami-0c20297a2c00b0528", + "ubuntu1404": "ami-0e4294a5b9d5de425", + "ubuntu1604": "ami-011d655005fe854e9" }, "ap-southeast-1": { - "alinux": "ami-02181eb4bbe285f28", - "centos6": "ami-07df16800a8f39379", - "centos7": "ami-06eec4db7a3965f04", - "ubuntu1404": "ami-0d3382bea35764ad2", - "ubuntu1604": "ami-04950204e84f8bf64" + "alinux": "ami-038312aa862774599", + "centos6": "ami-00063e5635939c9d1", + "centos7": "ami-0f610508513f2012f", + "ubuntu1404": "ami-01e6359021e3bac23", + "ubuntu1604": "ami-03428422e2cb20c9f" }, "ap-southeast-2": { - "alinux": "ami-03199596cd474bb05", - "centos6": "ami-09b23d993fbc703d9", - "centos7": "ami-0ab1def1c27a54ada", - "ubuntu1404": "ami-0a2a8aa487ce39e8c", - "ubuntu1604": "ami-02b4175018a85c03d" + "alinux": "ami-0dce078cd2c343a5c", + "centos6": "ami-015e730525001bf53", + "centos7": "ami-09d0b89439c0c1b65", + "ubuntu1404": "ami-0cfebd51a3470f1d4", + "ubuntu1604": "ami-0bbef9e2b1170757f" }, "ca-central-1": { - "alinux": "ami-099a5f4b65d56215e", - "centos6": "ami-0af06655a7341c2b5", - "centos7": "ami-089b3d6d4ef8c5772", - "ubuntu1404": "ami-0bc510154aa82211d", - "ubuntu1604": "ami-04a4a63323b55af6e" + "alinux": "ami-04e27bd54e171fbad", + "centos6": "ami-0fea713db092ac77f", + "centos7": "ami-0362a3ef26ab5dfce", + "ubuntu1404": "ami-0097472502a04776d", + "ubuntu1604": "ami-0916119fde83c29b7" }, "eu-central-1": { - "alinux": "ami-00e39ce170dbd6e25", - "centos6": "ami-0362d5eb8ec477a30", - "centos7": "ami-0842b79de396801b5", - "ubuntu1404": "ami-0174c3f5501fc441b", - "ubuntu1604": "ami-089e9903d9c3bee1b" + "alinux": "ami-075bf1c36cf6b855f", + "centos6": "ami-0f6b91d011f44aaf6", + "centos7": "ami-03d5519f5f4e7619f", + "ubuntu1404": "ami-0a82ac2872821deef", + "ubuntu1604": "ami-003273c4072efbe43" }, "eu-west-1": { - "alinux": "ami-059b3db381c18305a", - "centos6": "ami-04c68c9303ee0165c", - "centos7": "ami-019ecc5629a990951", - "ubuntu1404": "ami-01848c6ae1a9c6460", - "ubuntu1604": "ami-033b9190bab9d42aa" + "alinux": "ami-08d507a759b9ee0e4", + "centos6": "ami-029accac823a2a844", + "centos7": "ami-0575304add4986551", + "ubuntu1404": "ami-0d6c90f092266b787", + "ubuntu1604": "ami-009af0d819973e1d6" }, "eu-west-2": { - "alinux": "ami-0df738bfb4cf98f4e", - "centos6": "ami-0d3a080fd047d6f03", - "centos7": "ami-03e914c8e1b836bcf", - "ubuntu1404": "ami-0b867b5579d0f7a08", - "ubuntu1604": "ami-049d2247a1c3d582c" + "alinux": "ami-03ddfb1462e2c92fd", + "centos6": "ami-032b6b895dab544c6", + "centos7": "ami-08263362b21b98916", + "ubuntu1404": "ami-0f23dffc4db122b53", + "ubuntu1604": "ami-029f01bbfec52a10e" }, "eu-west-3": { - "alinux": "ami-0b1472bf5fed029bd", - "centos6": "ami-0ce8fcafcd4cb66ba", - "centos7": "ami-099b3883ce5e219b3", - "ubuntu1404": "ami-0e8f93d19635c5d49", - "ubuntu1604": "ami-09c4322a65746f77b" + "alinux": "ami-0e72015cf2b21159f", + "centos6": "ami-039be4bd46c878e2c", + "centos7": "ami-0befb803ea7ce1b83", + "ubuntu1404": "ami-02b6ca8fd14f58265", + "ubuntu1604": "ami-0ae405adcb3d1477c" }, "sa-east-1": { - "alinux": "ami-0a390e1998fb6b22f", - "centos6": "ami-010873231de6443db", - "centos7": "ami-0edbfab1cbd73ac82", - "ubuntu1404": "ami-048422e42509a1596", - "ubuntu1604": "ami-0740b75b4caaa3b77" + "alinux": "ami-02bd755bfe8704cef", + "centos6": "ami-0e507bdec09b8a091", + "centos7": "ami-0860c11596f954bbc", + "ubuntu1404": "ami-04e943b561cd32659", + "ubuntu1604": "ami-0b0057ecd5c465d09" }, "us-east-1": { - "alinux": "ami-0fd6854902340b407", - "centos6": "ami-0051f4828527649d0", - "centos7": "ami-00976a3c38aaac1a2", - "ubuntu1404": "ami-0ba2fcbf9fa378762", - "ubuntu1604": "ami-05790a6a634720a0d" + "alinux": "ami-07f61c3e18538c70c", + "centos6": "ami-091bbc83b27f92634", + "centos7": "ami-06c93be112f880acd", + "ubuntu1404": "ami-0920fa86d5a85a07a", + "ubuntu1604": "ami-0dfb1662fcc845c55" }, "us-east-2": { - "alinux": "ami-04fc90a3f60cb3dc7", - "centos6": "ami-0a585da16a01304bb", - "centos7": "ami-0f7dbb8d94e96b0ab", - "ubuntu1404": "ami-05aea9ea89d577194", - "ubuntu1604": "ami-0a0fcd1219e40a8f5" + "alinux": "ami-096b7925b1f9c8cbb", + "centos6": "ami-0fa89e68b0222f50b", + "centos7": "ami-0493261a1b2adfd27", + "ubuntu1404": "ami-0d63a602f26709e70", + "ubuntu1604": "ami-01bd1361428c384c3" }, "us-west-1": { - "alinux": "ami-0054acc8361046ccc", - "centos6": "ami-0fcbc3afb66cfcffd", - "centos7": "ami-0fae379328b9061bc", - "ubuntu1404": "ami-0089ace30f2612d13", - "ubuntu1604": "ami-056472d51cf2fed45" + "alinux": "ami-04794da830cb9dc86", + "centos6": "ami-06f3909be633646b9", + "centos7": "ami-0af95249ebb8de7a5", + "ubuntu1404": "ami-06fe4f837d8715dbb", + "ubuntu1604": "ami-0e144dd24634766a2" }, "us-west-2": { - "alinux": "ami-01382f63e2667a7d1", - "centos6": "ami-0430c74956ce8e41a", - "centos7": "ami-0df85f5bc2d980e57", - "ubuntu1404": "ami-06142a55749b7912b", - "ubuntu1604": "ami-0702d59e57ada76b8" + "alinux": "ami-03f86a2920360dfbe", + "centos6": "ami-087d4f29315fd19d2", + "centos7": "ami-0a259cf8220fabdcb", + "ubuntu1404": "ami-01170828a21d86a72", + "ubuntu1604": "ami-02087bf0ff99cc127" }, "us-gov-west-1": { - "alinux": "ami-af2cbece", - "ubuntu1404": "ami-4aca572b", - "ubuntu1604": "ami-3dc8555c" + "alinux": "ami-cfd34dae", + "ubuntu1404": "ami-c2d34da3", + "ubuntu1604": "ami-0fd6486e" } }, "OSFeatures": { @@ -1772,8 +1772,8 @@ }, "CfnClusterVersions": { "default": { - "cfncluster": "cfncluster-1.5.3", - "cookbook": "cfncluster-cookbook-1.5.2", + "cfncluster": "cfncluster-1.5.4", + "cookbook": "cfncluster-cookbook-1.5.4", "chef": "14.2.0", "ridley": "5.1.1", "berkshelf": "7.0.4", @@ -2089,6 +2089,37 @@ } ] }, + { + "Sid": "S3GetObj", + "Action": [ + "s3:GetObject" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Fn::FindInMap": [ + "AWSRegion2Capabilites", + { + "Ref": "AWS::Region" + }, + "arn" + ] + }, + ":s3:::", + { + "Ref": "AWS::Region" + }, + "-cfncluster/*" + ] + ] + } + ] + }, { "Sid": "SQSList", "Action": [ diff --git a/docs/source/conf.py b/docs/source/conf.py index 99d5f2b405..621d23a311 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -52,7 +52,7 @@ # The short X.Y version. version = '1.5' # The full version, including alpha/beta/rc tags. -release = '1.5.3' +release = '1.5.4' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/docs/source/configuration.rst b/docs/source/configuration.rst index 41f8fdd517..86e5d1b6c6 100644 --- a/docs/source/configuration.rst +++ b/docs/source/configuration.rst @@ -50,9 +50,9 @@ Attempts to validate that resources defined in parameters actually exist. :: aws ^^^ -This is the AWS credentials section (required). These settings apply to all clusters. +This is the AWS credentials/region section (required). These settings apply to all clusters. -If not defined, boto will attempt to use a) environment or b) EC2 IAM role. :: +We highly recommend use of the environment, EC2 IAM Roles, or storing credentials using the `AWS CLI `_ to store credentials, rather than storing them in the CfnCluster config file. :: [aws] aws_access_key_id = #your_aws_access_key_id @@ -212,7 +212,7 @@ Defaults to NONE for the default template. :: pre_install_args """""""""""""""" Quoted list of arguments to be passed to preinstall script - + Defaults to NONE for the default template. :: pre_install_args = NONE @@ -220,7 +220,7 @@ Defaults to NONE for the default template. :: post_install """""""""""" URL to a postinstall script. This is executed after any of the boot_as_* scripts are run - + Can be specified in "http://hostname/path/to/script.sh" or "s3://bucketname/path/to/script.sh" format. Defaults to NONE for the default template. :: @@ -230,7 +230,7 @@ Defaults to NONE for the default template. :: post_install_args """"""""""""""""" Arguments to be passed to postinstall script - + Defaults to NONE for the default template. :: post_install_args = NONE @@ -238,15 +238,15 @@ Defaults to NONE for the default template. :: proxy_server """""""""""" HTTP(S) proxy server, typically http://x.x.x.x:8080 - + Defaults to NONE for the default template. :: proxy_server = NONE placement_group """"""""""""""" -Cluster placement group. The can be one of three values: NONE, DYNAMIC and an existing placement group name. When DYNAMIC is set, a unique placement group will be created as part of the cluster and deleted when the cluster is deleted. - +Cluster placement group. The can be one of three values: NONE, DYNAMIC and an existing placement group name. When DYNAMIC is set, a unique placement group will be created as part of the cluster and deleted when the cluster is deleted. + Defaults to NONE for the default template. More information on placement groups can be found `here `_:: placement_group = NONE @@ -254,7 +254,7 @@ Defaults to NONE for the default template. More information on placement groups placement """"""""" Cluster placement logic. This enables the whole cluster or only compute to use the placement group. - + Defaults to cluster in the default template. :: placement = cluster @@ -262,7 +262,7 @@ Defaults to cluster in the default template. :: ephemeral_dir """"""""""""" If instance store volumes exist, this is the path/mountpoint they will be mounted on. - + Defaults to /scratch in the default template. :: ephemeral_dir = /scratch @@ -270,15 +270,15 @@ Defaults to /scratch in the default template. :: shared_dir """""""""" Path/mountpoint for shared EBS volume - + Defaults to /shared in the default template. See :ref:`EBS Section ` for details on working with EBS volumes:: shared_dir = /shared encrypted_ephemeral """"""""""""""""""" -Encrypted ephemeral drives. In-memory keys, non-recoverable. If true, CfnCluster will generate an ephemeral encryption key in memroy and using LUKS encryption, encrypt your instance store volumes. - +Encrypted ephemeral drives. In-memory keys, non-recoverable. If true, CfnCluster will generate an ephemeral encryption key in memroy and using LUKS encryption, encrypt your instance store volumes. + Defaults to false in default template. :: encrypted_ephemeral = false @@ -302,10 +302,10 @@ Defaults to 15 in default template. :: base_os """"""" OS type used in the cluster - + Defaults to alinux in the default template. Available options are: alinux, centos6, centos7, ubuntu1404 and ubuntu1604 -Note: The base_os determines the username used to log into the cluster. +Note: The base_os determines the username used to log into the cluster. * Centos 6 & 7: ``centos`` * Ubuntu: ``ubuntu`` @@ -408,7 +408,7 @@ ssh_from CIDR formatted IP range in which to allow SSH access from. This is only used when cfncluster creates the security group. - + Defaults to 0.0.0.0/0 in the default template. :: ssh_from = 0.0.0.0/0 @@ -416,7 +416,7 @@ Defaults to 0.0.0.0/0 in the default template. :: additional_sg """"""""""""" Additional VPC security group Id for all instances. - + Defaults to NONE in the default template. :: additional_sg = sg-xxxxxx @@ -465,7 +465,7 @@ EBS Volume configuration settings for the volume mounted on the master node and ebs_snapshot_id """"""""""""""" Id of EBS snapshot if using snapshot as source for volume. - + Defaults to NONE for default template. :: ebs_snapshot_id = snap-xxxxx @@ -481,7 +481,7 @@ Defaults to gp2 for default template. :: volume_size """"""""""" Size of volume to be created (if not using a snapshot). - + Defaults to 20GB for default template. :: volume_size = 20 @@ -522,7 +522,7 @@ Settings which define how the compute nodes scale. :: scaling_threshold """"""""""""""""" Threshold for triggering CloudWatch ScaleUp action. - + Defaults to 1 for default template. :: scaling_threshold = 1 @@ -530,7 +530,7 @@ Defaults to 1 for default template. :: scaling_adjustment """""""""""""""""" Number of instances to add when called CloudWatch ScaleUp action. - + Defaults to 1 for default template. :: scaling_adjustment = 1 @@ -539,7 +539,7 @@ Defaults to 1 for default template. :: scaling_threshold2 """""""""""""""""" Threshold for triggering CloudWatch ScaleUp2 action. - + Defaults to 200 for default template. :: scaling_threshold2 = 200 @@ -547,7 +547,7 @@ Defaults to 200 for default template. :: scaling_adjustment2 """"""""""""""""""" Number of instances to add when called CloudWatch ScaleUp2 action - + Defaults to 20 for default template. :: scaling_adjustment2 = 20 @@ -555,7 +555,7 @@ Defaults to 20 for default template. :: scaling_period """""""""""""" Period to measure ScalingThreshold. - + Defaults to 60 for default template. :: scaling_period = 60 @@ -563,7 +563,7 @@ Defaults to 60 for default template. :: scaling_evaluation_periods """""""""""""""""""""""""" Number of periods to measure ScalingThreshold. - + Defaults to 2 for default template. :: scaling_evaluation_periods = 2 @@ -571,7 +571,7 @@ Defaults to 2 for default template. :: scaling_cooldown """""""""""""""" Amount of time in seconds to wait before attempting further scaling actions. - + Defaults to 300 for the default template. :: scaling_cooldown = 300 diff --git a/docs/source/iam.rst b/docs/source/iam.rst index 9f9f86e040..79baad8535 100644 --- a/docs/source/iam.rst +++ b/docs/source/iam.rst @@ -4,8 +4,10 @@ IAM in CfnCluster ======================== .. warning:: - Between CfnCluster 1.4.2 and 1.5.0 we added a change to the `CfnClusterInstancePolicy` that adds "ec2:DescribeVolumes" permissions. If you're using a custom policy (e.g. you specify "ec2_iam_role" in your config) be sure it includes this new permission. + Between CfnCluster 1.5.3 and 1.6.0 we added a change to the `CfnClusterInstancePolicy` that adds “s3:GetObject” permissions on objects in -cfncluster bucket. + If you're using a custom policy (e.g. you specify "ec2_iam_role" in your config) be sure it includes this new permission. + Between CfnCluster 1.4.2 and 1.5.0 we added a change to the `CfnClusterInstancePolicy` that adds "ec2:DescribeVolumes" permissions. If you're using a custom policy (e.g. you specify "ec2_iam_role" in your config) be sure it includes this new permission. CfnCluster utilizes multiple AWS services to deploy and operate a cluster. The services used are listed in the :ref:`AWS Services used in CfnCluster ` section of the documentation. @@ -279,7 +281,8 @@ CfnClusterUserPolicy "cloudformation:DescribeStackResource", "cloudformation:DescribeStackResources", "cloudformation:DescribeStacks", - "cloudformation:ListStacks" + "cloudformation:ListStacks", + "cloudformation:GetTemplate" ], "Effect": "Allow", "Resource": "*" @@ -336,6 +339,38 @@ CfnClusterUserPolicy ], "Effect": "Allow", "Resource": "*" - } + }, + { + "Sid": "S3GetObj", + "Action": [ + "s3:GetObject" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Fn::FindInMap": [ + "AWSRegion2Capabilites", + { + "Ref": "AWS::Region" + }, + "arn" + ] + }, + ":s3:::", + { + "Ref": "AWS::Region" + }, + "-cfncluster/*" + ] + ] + } + ] + }, + ] } diff --git a/docs/source/pre_post_install.rst b/docs/source/pre_post_install.rst index c07c4b4bdb..fb3c4f0aaf 100644 --- a/docs/source/pre_post_install.rst +++ b/docs/source/pre_post_install.rst @@ -3,9 +3,9 @@ Custom Bootstrap Actions ======================== -CfnCluster can execute arbitrary code either before(pre) or after(post) the main bootstrap action during cluster creation. This code is typically stored in S3 and accessed via HTTP(S) during cluster creation. The code will be executed as root and can be in any script language supported by the cluster OS, typically `bash` or `python`. +CfnCluster can execute arbitrary code either before(pre) or after(post) the main bootstrap action during cluster creation. This code is typically stored in S3 and accessed via HTTP(S) during cluster creation. The code will be executed as root and can be in any script language supported by the cluster OS, typically `bash` or `python`. -pre-install actions are called before any cluster deployment bootstrap such as configuring NAT, EBS and the scheduler. Typical pre-install actions may include modifying storage, adding extra users or packages. +pre-install actions are called before any cluster deployment bootstrap such as configuring NAT, EBS and the scheduler. Typical pre-install actions may include modifying storage, adding extra users or packages. post-install actions are called after cluster bootstrap is complete, as the last action before an instance is considered complete. Typical post-install actions may include changing scheduler settings, modifying storage or packages. @@ -33,6 +33,16 @@ The following config settings are used to define pre/post-install actions and ar # (defaults to NONE for the default template) post_install_args = NONE +Arguments +--------- +The first two arguments ``$0`` and ``$1`` are reserved for the script name and url. + +:: + + $0 => the script name + $1 => s3 url + $n => args set by pre/post_install_args + Example ------- diff --git a/tests/cfncluster-release-check.py b/tests/cfncluster-release-check.py index 5088108b89..4ea4f64c5c 100755 --- a/tests/cfncluster-release-check.py +++ b/tests/cfncluster-release-check.py @@ -164,7 +164,7 @@ def run_test(region, distro, scheduler, instance_type, key_name, extra_args): prochelp.exec_command(['scp'] + ssh_params + [os.path.join(_dirname(), 'cluster-check.sh'), '%s@%s:.' % (username, master_ip)], stdout=out_f, stderr=sub.STDOUT, universal_newlines=True) - prochelp.exec_command(['ssh', '-n'] + ssh_params + ['%s@%s' % (username, master_ip), '/bin/bash --login cluster-check.sh %s' % scheduler], + prochelp.exec_command(['ssh', '-n'] + ssh_params + ['%s@%s' % (username, master_ip), '/bin/bash --login cluster-check.sh submit %s' % scheduler], stdout=out_f, stderr=sub.STDOUT, universal_newlines=True) _double_writeln(out_f, 'SUCCESS: %s!!' % (testname)) diff --git a/tests/cluster-check.sh b/tests/cluster-check.sh index 4dd151ef6b..ae35ea83ef 100755 --- a/tests/cluster-check.sh +++ b/tests/cluster-check.sh @@ -22,13 +22,10 @@ # node from the master node). # -# in case the scheduler goes nuts, wrap ourselves in a timeout so -# there's a bounded completion time -if test "$CHECK_CLUSTER_SUBPROCESS" = ""; then - export CHECK_CLUSTER_SUBPROCESS=1 - timeout -s KILL 10m /bin/bash ./cluster-check.sh "$@" - exit $? -fi +# Usage: +# cluster-check.sh {submit | scaledown_check} +# +set -e sge_get_slots() { local -- ppn i=0 @@ -71,30 +68,54 @@ torque_get_slots() { echo ${ppn} } +submit_launch() { + # in case the scheduler goes nuts, wrap ourselves in a timeout so + # there's a bounded completion time + if test "$CHECK_CLUSTER_SUBPROCESS" = ""; then + export CHECK_CLUSTER_SUBPROCESS=1 + timeout -s KILL 10m /bin/bash ./cluster-check.sh "$@" + exit $? + fi -scheduler="$1" -# job1: 8m30s -_sleepjob1=510 -# job2: 2m -_sleepjob2=120 + scheduler="$2" -echo "--> scheduler: $scheduler" + echo "--> scheduler: $scheduler" -set -e + submit_init ${scheduler} + + ${scheduler}_submit -# we submit 2 1-node jobs, each of which are a sleep. -# The whole thing has to run in 10 minutes, or the kill above will -# fail the job, which means that the jobs must run at the same time. -# The initial cluster is 1 nodes, so we'll need to scale up 1 further node in -# less than 8 minutes in order for the test to succeed. + done=0 + while test $done = 0 ; do + if test -f job1.done -a -f job2.done; then + done=1 + else + sleep 1 + fi + done +} + +submit_init() { + # we submit 2 1-node jobs, each of which are a sleep. + # The whole thing has to run in 10 minutes, or the kill above will + # fail the job, which means that the jobs must run at the same time. + # The initial cluster is 1 nodes, so we'll need to scale up 1 further node in + # less than 8 minutes in order for the test to succeed. -if test "$scheduler" = "slurm" ; then - _ppn=$(slurm_get_slots) + # job1: 8m30s + export _sleepjob1=510 + # job2: 2m + export _sleepjob2=120 + + scheduler=$1 + export _ppn=$(${scheduler}_get_slots) if [ -z "${_ppn}" ]; then - >&2 echo "The number of slots per instance couldn't be retrieved, no compute nodes available in Slurm cluster" + >&2 echo "The number of slots per instance couldn't be retrieved, no compute nodes available in ${scheduler} cluster" exit 1 fi +} +slurm_submit() { cat > job1.sh <&2 echo "The number of slots per instance couldn't be retrieved, no compute nodes available in sge cluster" - exit 1 - fi - - count=$((ppn)) +sge_submit() { + count=$((_ppn)) cat > job1.sh <&2 echo "The number of slots per instance couldn't be retrieved, no compute nodes available in Torque cluster" - exit 1 - fi - +torque_submit() { cat > job1.sh < scheduler: $scheduler" + + ${scheduler}_scaledown_check + + aws_scaledown_check +} + +slurm_scaledown_check() { + : # TODO +} + +sge_scaledown_check() { + : # TODO +} + +torque_scaledown_check() { + : # TODO +} + +aws_scaledown_check() { + : # TODO +} + +main() { + case "$1" in + submit) + submit_launch "$@" + ;; + scaledown_check) + scaledown_check_launch "$@" + ;; + *) + echo "!! Unknown command $1 !!" + exit 1 + ;; + esac +} + +main "$@"