betty.life_cycle.manage module#
Life cycle management.
- final class betty.life_cycle.manage.LifeCycleManager#
Bases:
LifeCycleA life cycle manager.
- __init__()#
- on(*callbacks: tuple[Bootstrapper, Shutdowner]) None#
Add a batch of callbacks.
The callbacks within the batch will be invoked concurrently.
- on_bootstrap(*bootstrappers: Bootstrapper) None#
Add a batch of bootstrap callbacks.
The callbacks within the batch will be invoked concurrently.
- on_shutdown(*shutdowners: Shutdowner) None#
Add a batch of shutdown callbacks.
The callbacks within the batch will be invoked concurrently.
- async synchronize(*life_cycles: Bootstrappable | Shutdownable) None#
Attach a batch of other life cycles to this one, and ensure they are all synchronized.
The life cycles within the batch will be bootstrapped and shut down concurrently.
- class betty.life_cycle.manage.ManagedLifeCycle#
Bases:
LifeCycleAn object that can bootstrap and shut down, and manage resources upon these events.
Subclasses and third party code can manage resources using the
life_cycleproperty, which ensures everything is done in order.- life_cycle: Final[LifeCycleManager]#
The life cycle manager.