cobald.daemon.runners.base_runner module
- class cobald.daemon.runners.base_runner.BaseRunner(asyncio_loop: AbstractEventLoop)[source]
Bases:
objectConcurrency backend on top of asyncio
- abstractmethod 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,OrphanedReturnor the raised exception must re-raised by this method.
- abstractmethod register_payload(payload)[source]
Register
payloadfor background execution in a threadsafe mannerThis runs
payloadas an orphaned background task as soon as possible. It is an error forpayloadto 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,OrphanedReturnor the raised exception is re-raised by this method.Implementations should override
manage_payloads()to customize their specific parts.