Components API¶
Components are objects that depend on a running service container. They are
embedded in Componentized
objects.
Since Componentized objects themselves are components, they form a tree of
Component
instances with the container as the root. An example
of a Component is lymph.core.interfaces.Interface
.
-
class
lymph.core.components.
Component
(error_hook=None, pool=None, metrics=None)¶ -
error_hook
¶ A Hook object that propagates exceptions for this component. Defaults to the
error_hook
of the parent component.
-
pool
¶ A pool that holds greenlets related to the component. Defaults to the
pool
of the parent component.
-
metrics
¶ An
Aggregate
of metrics for this component. Defaults to themetrics
of the parent component.
-
on_start
()¶ Called when the container is started.
-
on_stop
()¶ Called when the container is stopped.
-
spawn
(func, *args, **kwargs)¶ Spawns a new greenlet in the greenlet pool of this component. If
func
exits with an exception, it is reported to theerror_hook
.
-