caikit.runtime.http_server.request_aborter
This module helps us know when a HTTP client call is cancelled, and we need to stop or undo work
Attributes
Classes
In order to actually interrupt threads doing the work, abortable contexts can be registered |
Module Contents
- class caikit.runtime.http_server.request_aborter.HttpRequestAborter(context: fastapi.Request, loop: asyncio.AbstractEventLoop | None = None, poll_time: float | None = 0.25)[source]
Bases:
caikit.runtime.work_management.abortable_context.ActionAborterIn order to actually interrupt threads doing the work, abortable contexts can be registered with an instance of this class in order to receive notification on request disconnection. This allows work to be terminated when a client time’s out or stops listening.
IFF the client request has been terminated, must_abort will return True.
- context
- event_loop
- poll_time = 0.25
- is_terminated
- abortable_context = None
- task
- __exit__(exc_type, exc_val, exc_tb)[source]
Automatically abort aborter when exiting contextmanager
- set_context(context: caikit.runtime.work_management.abortable_context.AbortableContext)[source]
Set the abortable context that must be notified to abort work