jina.serve.runtimes.asyncio module#
- class jina.serve.runtimes.asyncio.AsyncNewLoopRuntime(args, cancel_event=None, **kwargs)[source]#
Bases:
BaseRuntime
,ABC
The async runtime to start a new event loop.
- run_forever()[source]#
Running method to block the main thread.
Run the event loop until a Future is done.
- async async_teardown()[source]#
The async method to clean up resources during teardown. This method should free all resources allocated during async_setup
- static activate(**kwargs)[source]#
Activate the runtime, does not apply to these runtimes
- Parameters
kwargs – extra keyword arguments
- static is_ready(ctrl_address, **kwargs)[source]#
Check if status is ready.
- Parameters
ctrl_address (
str
) – the address where the control request needs to be sentkwargs – extra keyword arguments
- Return type
bool
- Returns
True if status is ready else False.
- static wait_for_ready_or_shutdown(timeout, ready_or_shutdown_event, ctrl_address, **kwargs)[source]#
Check if the runtime has successfully started
- Parameters
timeout (
Optional
[float
]) – The time to wait before readiness or failure is determinedctrl_address (
str
) – the address where the control message needs to be sentready_or_shutdown_event (
Union
[Event
,Event
]) – the multiprocessing event to detect if the process failed or is readykwargs – extra keyword arguments
- Returns
True if is ready or it needs to be shutdown