def main(): parser = argparse.ArgumentParser(description='Drives Funkload.') parser.add_argument('repo', help='Git repository or local directory', nargs='?') parser.add_argument('--version', action='store_true', default=False, help='Displays Circus version and exits.') parser.add_argument('--log-level', dest='loglevel', default='info', choices=LOG_LEVELS.keys() + [key.upper() for key in LOG_LEVELS.keys()], help="log level") parser.add_argument('--log-output', dest='logoutput', default='-', help="log output") parser.add_argument('--distributed', action='store_true', default=False, help='Run with the nodes') parser.add_argument('--fixture-plugin', default=None, help='The fixture to use for this loadtest.') parser.add_argument('--fixture-options', default=None, help='Options to pass to the fixture.') parser.add_argument('--server', dest='server', default=None, help="Marteau Server to send the job to") args = parser.parse_args() if args.version: print(__version__) sys.exit(0) if args.repo is None: parser.print_usage() sys.exit(0) # configure the logger configure_logger(logger, args.loglevel, args.logoutput) if args.server and os.path.exists(args.repo): logging.error("You can't run on a server and provide a local dir!") sys.exit(1) if args.server: logger.info('Sending the job to the Marteau server') test = send_job(args.repo, args.server) logger.info('Test added at %r' % test) logger.info('Bye!') sys.exit(0) else: logger.info('Hammer ready. Where are the nails ?') try: res = run_loadtest(args.repo, distributed=args.distributed, fixture_plugin=args.fixture_plugin, fixture_options=args.fixture_options) logger.info('Report generated at %r' % res) except KeyboardInterrupt: sys.exit(1) finally: logger.info('Bye!')
def main(): parser = argparse.ArgumentParser(description='Marteau Server') parser.add_argument('config', help='Config file', nargs='?') parser.add_argument('--version', action='store_true', default=False, help='Displays Marteau version and exits.') parser.add_argument('--log-level', dest='loglevel', default='info', choices=LOG_LEVELS.keys() + [key.upper() for key in LOG_LEVELS.keys()], help="log level") parser.add_argument('--log-output', dest='logoutput', default='-', help="log output") parser.add_argument('--host', help='Host', default='0.0.0.0') parser.add_argument('--port', help='Port', type=int, default=8080) args = parser.parse_args() if args.version: print(__version__) sys.exit(0) if args.config is None: parser.print_usage() sys.exit(0) # configure the logger configure_logger(logger, args.loglevel, args.logoutput) # loading the config file config = Config(args.config) # loading the app & the queue global_config = {} if config.has_section('marteau'): settings = config.get_map('marteau') else: settings = {} # check is redis is running if not redis_available(): raise IOError('Marteau needs Redis to run.') # loading the fixtures plugins for fixture in settings.get('fixtures', []): import_string(fixture) logger.info('Loaded plugins: %s' % ', '.join(get_fixtures())) app = webapp(global_config, **settings) try: httpd = SocketIOServer((args.host, args.port), app, resource="socket.io", policy_server=False) logger.info('Hammer ready, at http://%s:%s. Where are the nails ?' % (args.host, args.port)) httpd.serve_forever() except KeyboardInterrupt: sys.exit(0) finally: logger.info('Bye!')
def main(): parser = argparse.ArgumentParser(description="Drives Funkload.") parser.add_argument("repo", help="Git repository or local directory", nargs="?") parser.add_argument("--version", action="store_true", default=False, help="Displays Circus version and exits.") parser.add_argument( "--log-level", dest="loglevel", default="info", choices=LOG_LEVELS.keys() + [key.upper() for key in LOG_LEVELS.keys()], help="log level", ) parser.add_argument("--log-output", dest="logoutput", default="-", help="log output") parser.add_argument("--distributed", action="store_true", default=False, help="Run with the nodes") parser.add_argument("--fixture-plugin", default=None, help="The fixture to use for this loadtest.") parser.add_argument("--fixture-options", default=None, help="Options to pass to the fixture.") parser.add_argument("--server", dest="server", default=None, help="Marteau Server to send the job to") args = parser.parse_args() if args.version: print(__version__) sys.exit(0) if args.repo is None: parser.print_usage() sys.exit(0) # configure the logger configure_logger(logger, args.loglevel, args.logoutput) if args.server and os.path.exists(args.repo): logging.error("You can't run on a server and provide a local dir!") sys.exit(1) if args.server: logger.info("Sending the job to the Marteau server") test = send_job(args.repo, args.server) logger.info("Test added at %r" % test) logger.info("Bye!") sys.exit(0) else: logger.info("Hammer ready. Where are the nails ?") try: res = run_loadtest( args.repo, distributed=args.distributed, fixture_plugin=args.fixture_plugin, fixture_options=args.fixture_options, ) logger.info("Report generated at %r" % res) except KeyboardInterrupt: sys.exit(1) finally: logger.info("Bye!")
def main(): parser = argparse.ArgumentParser(description='Funkload Server') parser.add_argument('--config', help='Config file, if any') parser.add_argument('--version', action='store_true', default=False, help='Displays Marteau version and exits.') parser.add_argument('--log-level', dest='loglevel', default='info', choices=LOG_LEVELS.keys() + [key.upper() for key in LOG_LEVELS.keys()], help="log level") parser.add_argument('--log-output', dest='logoutput', default='-', help="log output") parser.add_argument('--host', help='Host', default='0.0.0.0') parser.add_argument('--port', help='Port', type=int, default=8080) args = parser.parse_args() if args.version: print(__version__) sys.exit(0) # configure the logger configure_logger(logger, args.loglevel, args.logoutput) # loading the config file config = Config() if args.config is not None: logger.info('Loading %r' % args.config) config.read([args.config]) # loading the app & the queue global_config = {} if config.has_section('marteau'): settings = config.get_map('marteau') else: settings = {} # loading the fixtures plugins for fixture in settings.get('fixtures', []): import_string(fixture) logger.info('Loaded plugins: %s' % ', '.join(get_fixtures())) app = webapp(global_config, **settings) try: httpd = make_server(args.host, args.port, app) logger.info('Hammer ready, at http://%s:%s. Where are the nails ?' % (args.host, args.port)) httpd.serve_forever() except KeyboardInterrupt: sys.exit(0) finally: logger.info('Bye!')
def main(): parser = argparse.ArgumentParser(description='Drives Funkload.') parser.add_argument('repo', help='Git repository or local directory', nargs='?') parser.add_argument('--version', action='store_true', default=False, help='Displays Marteau version and exits.') parser.add_argument('--log-level', dest='loglevel', default='info', choices=LOG_LEVELS.keys() + [key.upper() for key in LOG_LEVELS.keys()], help="log level") parser.add_argument('--log-output', dest='logoutput', default='-', help="log output") parser.add_argument('--fl-result-path', dest='result_path', default=None, help="Output path of Funkload result xml files.") parser.add_argument('--distributed', action='store_true', default=False, help='Run with the nodes') parser.add_argument('--fixture-plugin', default=None, help='The fixture to use for this loadtest.') parser.add_argument('--fixture-options', default=None, help='Options to pass to the fixture.') parser.add_argument('--server', dest='server', default=None, help="Marteau Server to send the job to") args = parser.parse_args() if args.version: print(__version__) sys.exit(0) if args.repo is None: parser.print_usage() sys.exit(0) # configure the logger configure_logger(logger, args.loglevel, args.logoutput) if args.server and os.path.exists(args.repo): logging.error("You can't run on a server and provide a local dir!") sys.exit(1) if args.server: logger.info('Sending the job to the Marteau server') test = send_job(args.repo, args.server) logger.info('Test added at %r' % test) logger.info('Bye!') sys.exit(0) else: options = { 'feedback': 1, 'feedback_endpoint': 'tcp://0.0.0.0:5555', 'feedback_publisher': 'tcp://0.0.0.0:5556' } logger.info('Hammer ready. Where are the nails ?') try: res = run_loadtest(args.repo, distributed=args.distributed, fl_result_path=args.result_path, fixture_plugin=args.fixture_plugin, fixture_options=args.fixture_options, options=options) logger.info('Report generated at %r' % res) except KeyboardInterrupt: sys.exit(1) finally: logger.info('Bye!')