asphalt.core.runner

asphalt.core.runner.run_application(component, *, event_loop_policy=None, max_threads=None, logging=20, start_timeout=10)

Configure logging and start the given root component in the default asyncio event loop.

Assuming the root component was started successfully, the event loop will continue running until the process is terminated.

Initializes the logging system first based on the value of logging:

By default, the logging system is initialized using basicConfig() using the INFO logging level.

The default executor in the event loop is replaced with a new ThreadPoolExecutor where the maximum number of threads is set to the value of max_threads or, if omitted, the default value of ThreadPoolExecutor.

Parameters:
  • component (Union[Component, Dict[str, Any]]) – the root component (either a component instance or a configuration dictionary where the special type key is either a component class or a module:varname reference to one)
  • event_loop_policy (Optional[str]) – entry point name (from the asphalt.core.event_loop_policies namespace) of an alternate event loop policy (or a module:varname reference to one)
  • max_threads (Optional[int]) – the maximum number of worker threads in the default thread pool executor (the default value depends on the event loop implementation)
  • logging (Union[Dict[str, Any], int, None]) – a logging configuration dictionary, logging level or None
  • start_timeout (Union[int, float, None]) – seconds to wait for the root component (and its subcomponents) to start up before giving up (None = wait forever)