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
: If the value is a dictionary, it is passed to
logging.config.dictConfig()
as argument.If the value is an integer, it is passed to
logging.basicConfig()
as the logging level.If the value is
None
, logging setup is skipped entirely.
By default, the logging system is initialized using
basicConfig()
using theINFO
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 ofmax_threads
or, if omitted, the default value ofThreadPoolExecutor
.- 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 amodule:varname
reference to one)event_loop_policy (str | None) – 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 (int | None) – 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)
- Return type:
None
- Initializes the logging system first based on the value of