def run(args, stdout=sys.stdout): """Sends out beacons, waits for replies, and optionally print debug info. :param args: Parsed output of the arguments added in `add_arguments()`. :param stdout: Standard output stream to write to. """ # Record the current time so we can figure out how long it took us to # do all this scanning. logger.configure(DEFAULT_LOG_VERBOSITY, logger.LoggingMode.COMMAND) interfaces = get_all_interfaces_definition(annotate_with_monitored=False) if args.verbose: print("Interface dictionary:\n%s" % pformat(interfaces), file=stdout) protocol = do_beaconing(args, interfaces=interfaces) if args.verbose: print("Transmit queue:\n%s" % pformat(protocol.tx_queue), file=stdout) print("Receive queue:\n%s" % pformat(protocol.rx_queue), file=stdout)
def execute_from_command_line(): # Limit concurrency in all thread-pools to ONE. from maasserver.utils import threads threads.install_default_pool(maxthreads=1) threads.install_database_unpool(maxthreads=1) # Disable all database connections in the reactor. from maasserver.utils import orm from twisted.internet import reactor assert not reactor.running, "The reactor has been started too early." reactor.callFromThread(orm.disable_all_database_connections) # Configure logging; Django is no longer responsible for this. Behave as # if we're always at an interactive terminal (i.e. do not wrap stdout or # stderr with log machinery). from provisioningserver import logger logger.configure(mode=logger.LoggingMode.COMMAND) # Hand over to Django. from django.core import management management.execute_from_command_line()
def run_region(): """Entry point for region test runner.""" options = [ "--with-crochet", "--with-resources", "--with-scenarios", "--with-select", "--select-dir=src/maasserver", "--select-dir=src/metadataserver", "--cover-package=maas,maasserver,metadataserver", "--cover-branches", # Reduce the logging level to INFO here as # DebuggingLoggerMiddleware logs the content of all the # requests at DEBUG level: we don't want this in the # tests as it's too verbose. "--logging-level=INFO", "--logging-clear-handlers", # Do not run tests tagged "legacy". "-a", "!legacy", ] inject_test_options(options) update_environ() init_asyncio_reactor() logger.configure(mode=logger.LoggingMode.COMMAND) # Limit concurrency in all thread-pools to ONE. threads.install_default_pool(maxthreads=1) threads.install_database_unpool(maxthreads=1) # Disable all database connections in the reactor. assert not reactor.running, "The reactor has been started too early." reactor.callFromThread(orm.disable_all_database_connections) # Configure Django import django django.setup() test_main()
def _configureLogging(self, verbosity: int): # Get something going with the logs. logger.configure(verbosity, logger.LoggingMode.TWISTD)