beamlime.applications.base.Application#
- class beamlime.applications.base.Application(logger, message_router)[source]#
Application class.
- Main Responsibilities:
Create/retrieve event loop.
Register handling methods if applicable.
Create/collect tasks of daemons (via
beamlime.applications.daemons.BaseDaemon.run()
method).
Methods
__init__
(logger, message_router)Cancel all tasks.
debug
(msg, *args[, stacklevel])error
(msg, *args[, stacklevel])info
(msg, *args[, stacklevel])register_daemon
(daemon)Register a daemon to the application.
register_handling_method
(event_tp, handler)Register handlers to the application message router.
run
()Register all handling methods and run all daemons.
stop_tasks
([message])warning
(msg, *args[, stacklevel])- register_daemon(daemon)[source]#
Register a daemon to the application.
Registered daemons will be scheduled in the event loop as
run()
method is called. The future of the daemon will be collected in theself.tasks
list.- Return type:
- register_handling_method(event_tp, handler)[source]#
Register handlers to the application message router.
- Return type:
- run()[source]#
Register all handling methods and run all daemons.
It retrieves or creates an event loop and schedules all coroutines(run methods) of its daemons.
See Asynchronous Programming for more details about why it handles the event loop like this.