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).

__init__(logger, message_router)[source]#

Methods

__init__(logger, message_router)

cancel_all_tasks()

Cancel all tasks.

debug(msg, *args[, stacklevel])

rtype:

None

error(msg, *args[, stacklevel])

rtype:

None

info(msg, *args[, stacklevel])

rtype:

None

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])

rtype:

None

warning(msg, *args[, stacklevel])

rtype:

None

class Stop(content)[source]#

A message to break the routing loop.

cancel_all_tasks()[source]#

Cancel all tasks.

Return type:

None

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 the self.tasks list.

Return type:

None

register_handling_method(event_tp, handler)[source]#

Register handlers to the application message router.

Return type:

None

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.