cobald.daemon.runners.trio_runner module

class cobald.daemon.runners.trio_runner.TrioRunner(asyncio_loop: AbstractEventLoop)[source]

Bases: BaseRunner

Runner for coroutines with trio

All active payloads are actively cancelled when the runner is closed.

async aclose()[source]

Shut down this runner

flavour: Any = <module 'trio' from '/home/docs/checkouts/readthedocs.org/user_builds/cobald/envs/latest/lib/python3.11/site-packages/trio/__init__.py'>
async manage_payloads()[source]

Implementation of managing payloads when run()

This method must continuously execute payloads sent to the runner. It may only return when stop() is called or if any orphaned payload return or raise. In the latter case, OrphanedReturn or the raised exception must re-raised by this method.

async ready()[source]

Wait until the runner is ready to accept payloads

register_payload(payload: Callable[[], Awaitable])[source]

Register payload for background execution in a threadsafe manner

This runs payload as an orphaned background task as soon as possible. It is an error for payload to return or raise anything without handling it.

run_payload(payload: Callable[[], Coroutine])[source]

Execute payload and return its result in a threadsafe manner

This runs payload as soon as possible, blocking until completion. Should payload return or raise anything, it is propagated to the caller.