aleph.toolkit.lifecycle module

aleph.toolkit.lifecycle.install_signal_handlers(loop: AbstractEventLoop, callback: Callable[[], object]) None[source]

Register SIGINT and SIGTERM handlers that invoke callback.

Re-registering replaces the previous handler. Silently no-ops on platforms that do not support loop.add_signal_handler (Windows).

async aleph.toolkit.lifecycle.safe_async_cleanup(name: str, awaitable: Awaitable[object]) None[source]

Await a cleanup coroutine, logging but never re-raising on failure.

Cleanup paths run during shutdown and must not mask the shutdown signal.