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_hookof the parent component.
-
pool¶ A pool that holds greenlets related to the component. Defaults to the
poolof the parent component.
-
metrics¶ An
Aggregateof metrics for this component. Defaults to themetricsof 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
funcexits with an exception, it is reported to theerror_hook.
-