cobald.daemon.runners.base_runner module
- class cobald.daemon.runners.base_runner.BaseRunner(asyncio_loop: AbstractEventLoop)[source]
Bases:
object
Concurrency backend on top of asyncio
- flavour = None
- abstract 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.
- abstract register_payload(payload)[source]
Register
payload
for background execution in a threadsafe mannerThis runs
payload
as an orphaned background task as soon as possible. It is an error forpayload
to return or raise anything without handling it.
- async run()[source]
Execute all current and future payloads in an asyncio coroutine
This method will continuously execute payloads sent to the runner. It only returns when
stop()
is called or if any orphaned payload returns or raises. In the latter case,OrphanedReturn
or the raised exception is re-raised by this method.Implementations should override
manage_payloads()
to customize their specific parts.