Пример #1
0
def main():
    """ Main entry point for the application. Runs the command parsed from the CLI
    using the argparse func system
    """
    # Exception raised on exit due to threading module loading before gevent
    # This preemptive patching prevents this
    # see: http://stackoverflow.com/questions/8774958/keyerror-in-module-threading-after-a-successful-py-test-run
    import sys

    if 'threading' in sys.modules:
        del sys.modules['threading']
    import gevent
    import gevent.monkey

    gevent.monkey.patch_all()

    # Setup logger & config
    from tranny.app import config
    # Execute the user command
    arguments = parse_args()

    try:
        if arguments.loglevel:
            log_level = arguments.loglevel.upper()
        elif config.has_option("log", "level"):
            log_level = config.get_default("log", "level")
        else:
            log_level = "INFO"

        setup_logging(config, log_level)

        if arguments.config:
            config.initialize(arguments.config)
        arguments.func(arguments)
    except Exception:
        logging.exception("Fatal error, cannot start!")
        sys.exit(1)
    else:
        sys.exit(0)
Пример #2
0
def main():
    """ Main entry point for the application. Runs the command parsed from the CLI
    using the argparse func system
    """
    # Exception raised on exit due to threading module loading before gevent
    # This preemptive patching prevents this
    # see: http://stackoverflow.com/questions/8774958/keyerror-in-module-threading-after-a-successful-py-test-run
    import sys

    if 'threading' in sys.modules:
        del sys.modules['threading']
    import gevent
    import gevent.monkey

    gevent.monkey.patch_all()

    # Setup logger & config
    from tranny.app import config
    # Execute the user command
    arguments = parse_args()

    try:
        if arguments.loglevel:
            log_level = arguments.loglevel.upper()
        elif config.has_option("log", "level"):
            log_level = config.get_default("log", "level")
        else:
            log_level = "INFO"

        setup_logging(config, log_level)

        if arguments.config:
            config.initialize(arguments.config)
        arguments.func(arguments)
    except Exception:
        logging.exception("Fatal error, cannot start!")
        sys.exit(1)
    else:
        sys.exit(0)
Пример #3
0
 def __init__(self, methodName='runTest'):
     super(TrannyTestCase, self).__init__(methodName=methodName)
     self.client_name = ''
     config.initialize()
Пример #4
0
 def reload(self):
     self._updater.kill()
     config.initialize()
Пример #5
0
 def reload(self):
     self._updater.kill()
     config.initialize()
Пример #6
0
 def __init__(self, methodName='runTest'):
     super(TrannyTestCase, self).__init__(methodName=methodName)
     self.client_name = ''
     config.initialize()