Exemplo n.º 1
0
def main():
    try:
        static.create_sc_config_dirs()
        logger.configure_sc_logging()
        warn_debug_file_moved()
        StarClusterCLI().main()
    except KeyboardInterrupt:
        print "Interrupted, exiting."
        sys.exit(1)
Exemplo n.º 2
0
def main():
    try:
        static.create_sc_config_dirs()
        logger.configure_sc_logging()
        warn_debug_file_moved()
        StarClusterCLI().main()
    except KeyboardInterrupt:
        print "Interrupted, exiting."
        sys.exit(1)
Exemplo n.º 3
0
def main():
    static.create_sc_config_dirs()
    logger.configure_sc_logging()
    warn_debug_file_moved()
    StarClusterCLI().main()
Exemplo n.º 4
0
def main():
    logger.configure_sc_logging()
    StarClusterCLI().main()
Exemplo n.º 5
0
#!/usr/bin/env python
import os
import sys
import time
import string
import optparse

from starcluster import config
from starcluster import cluster
from starcluster import spinner
from starcluster import exception
from starcluster import logger
logger.configure_sc_logging()
log = logger.log


def deploy_img(img_path,
               vol_size,
               arch,
               region,
               src_ami,
               dev=None,
               kernel_id=None,
               ramdisk_id=None,
               platform=None,
               remove_old=False,
               **cluster_kwargs):
    """
    Deploy a filesystem image as a new AMI in a given region.

    This method creates a 1-node host cluster in the desired `region`, copies
Exemplo n.º 6
0
    def parse_subcommands(self, gparser, subcmds):
        """
        Parse given global arguments, find subcommand from given list of
        subcommand objects, parse local arguments and return a tuple of
        global options, selected command object, command options, and
        command arguments.

        Call execute() on the command object to run. The command object has
        members 'gopts' and 'opts' set for global and command options
        respectively, you don't need to call execute with those but you could
        if you wanted to.
        """
        print self.get_description()

        # Build map of name -> command and docstring.
        cmds_header = 'Available Commands:'
        gparser.usage += '\n\n%s\n' % cmds_header
        gparser.usage += '%s\n' % ('-' * len(cmds_header))
        gparser.usage += "NOTE: Pass --help to any command for a list of its "
        gparser.usage += 'options and detailed usage information\n\n'
        for sc in subcmds:
            helptxt = sc.__doc__.splitlines()[3].strip()
            gparser.usage += '- %s: %s\n' % (', '.join(sc.names),
                                           helptxt)
            for n in sc.names:
                assert n not in self.subcmds_map
                self.subcmds_map[n] = sc

        # Declare and parse global options.
        gparser.disable_interspersed_args()

        gopts, args = gparser.parse_args()
        if not args:
            gparser.print_help()
            raise SystemExit("\nError: you must specify an action.")
        subcmdname, subargs = args[0], args[1:]


        ####  CHANGED
        """
            CHANGE LOG FILE TO USER-SUPPLIED LOCATION IF PROVIDED
        """
        if gopts.LOGFILE:
            static.DEBUG_FILE = gopts.LOGFILE
            #### REM: THIS REMOVES starcluster.logger.ConsoleLogger HANDLER
            while len(log.handlers) > 0:
                log.removeHandler(log.handlers[0])
            logger.configure_sc_logging()


        # set debug level if specified
        if gopts.DEBUG:
            console.setLevel(logger.DEBUG)


        #### CHANGED
        """
            ADDED config_file TO utils FOR USE BY commands.start.addopts
        """
        utils.config_file = gopts.CONFIG



        # load StarClusterConfig into global options
        try:
            cfg = config.StarClusterConfig(gopts.CONFIG)
            cfg.load()
        except exception.ConfigNotFound, e:
            log.error(e.msg)
            e.display_options()
            sys.exit(1)
Exemplo n.º 7
0
def main():
    static.create_sc_config_dirs()
    logger.configure_sc_logging()
    warn_debug_file_moved()
    StarClusterCLI().main()
Exemplo n.º 8
0
    def parse_subcommands(self, gparser, subcmds):
        """
        Parse given global arguments, find subcommand from given list of
        subcommand objects, parse local arguments and return a tuple of
        global options, selected command object, command options, and
        command arguments.

        Call execute() on the command object to run. The command object has
        members 'gopts' and 'opts' set for global and command options
        respectively, you don't need to call execute with those but you could
        if you wanted to.
        """
        print self.get_description()

        # Build map of name -> command and docstring.
        cmds_header = 'Available Commands:'
        gparser.usage += '\n\n%s\n' % cmds_header
        gparser.usage += '%s\n' % ('-' * len(cmds_header))
        gparser.usage += "NOTE: Pass --help to any command for a list of its "
        gparser.usage += 'options and detailed usage information\n\n'
        for sc in subcmds:
            helptxt = sc.__doc__.splitlines()[3].strip()
            gparser.usage += '- %s: %s\n' % (', '.join(sc.names), helptxt)
            for n in sc.names:
                assert n not in self.subcmds_map
                self.subcmds_map[n] = sc

        # Declare and parse global options.
        gparser.disable_interspersed_args()

        gopts, args = gparser.parse_args()
        if not args:
            gparser.print_help()
            raise SystemExit("\nError: you must specify an action.")
        subcmdname, subargs = args[0], args[1:]

        ####  CHANGED
        """
            CHANGE LOG FILE TO USER-SUPPLIED LOCATION IF PROVIDED
        """
        if gopts.LOGFILE:
            static.DEBUG_FILE = gopts.LOGFILE
            #### REM: THIS REMOVES starcluster.logger.ConsoleLogger HANDLER
            while len(log.handlers) > 0:
                log.removeHandler(log.handlers[0])
            logger.configure_sc_logging()

        # set debug level if specified
        if gopts.DEBUG:
            console.setLevel(logger.DEBUG)

        #### CHANGED
        """
            ADDED config_file TO utils FOR USE BY commands.start.addopts
        """
        utils.config_file = gopts.CONFIG

        # load StarClusterConfig into global options
        try:
            cfg = config.StarClusterConfig(gopts.CONFIG)
            cfg.load()
        except exception.ConfigNotFound, e:
            log.error(e.msg)
            e.display_options()
            sys.exit(1)
Exemplo n.º 9
0
import os

from starcluster import logger

import utils

logger.configure_sc_logging()
log = logger.log

settings = {
    'library_path': os.path.dirname(os.path.realpath(__file__))
}