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 _configureThreads(self): from maasserver.utils import threads threads.install_default_pool() threads.install_database_pool()