Mercurial > repos > shellac > guppy_basecaller
diff env/bin/kill_instance @ 5:9b1c78e6ba9c draft default tip
"planemo upload commit 6c0a8142489327ece472c84e558c47da711a9142"
author | shellac |
---|---|
date | Mon, 01 Jun 2020 08:59:25 -0400 |
parents | 79f47841a781 |
children |
line wrap: on
line diff
--- a/env/bin/kill_instance Thu May 14 16:47:39 2020 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -#!/Users/pldms/Development/Projects/2020/david-matthews-galaxy/guppy_basecaller/env/bin/python3 - -import sys -from optparse import OptionParser - -import boto -from boto.ec2 import regions - - - -def kill_instance(region, ids): - """Kill an instances given it's instance IDs""" - # Connect the region - ec2 = boto.connect_ec2(region=region) - for instance_id in ids: - print("Stopping instance: %s" % instance_id) - ec2.terminate_instances([instance_id]) - - -if __name__ == "__main__": - parser = OptionParser(usage="kill_instance [-r] id [id ...]") - parser.add_option("-r", "--region", help="Region (default us-east-1)", dest="region", default="us-east-1") - (options, args) = parser.parse_args() - if not args: - parser.print_help() - sys.exit(1) - for r in regions(): - if r.name == options.region: - region = r - break - else: - print("Region %s not found." % options.region) - sys.exit(1) - - kill_instance(region, args)