API: Decorators: AsyncIOTask, asynciotask.

class pooled.AsyncIOTask

Wrap to asyncio.Task.

__init__(func, *, loop_getter, loop_getter_need_context)
Parameters:
  • func (typing.Optional[typing.Callable[.., typing.Awaitable]]) – function to wrap
  • loop_getter (typing.Union[typing.Callable[.., asyncio.AbstractEventLoop], asyncio.AbstractEventLoop]) – Method to get event loop, if wrap in asyncio task
  • loop_getter_need_context (bool) – Loop getter requires function context

Note

Attributes is read-only

loop_getter

typing.Union[typing.Callable[..., asyncio.AbstractEventLoop], asyncio.AbstractEventLoop] Loop getter.

loop_getter_need_context

bool - Loop getter will use function call arguments.

_func

typing.Optional[typing.Callable[..., typing.Awaitable]] Wrapped function. Used for inheritance only.

__call__(*args, **kwargs)

Decorator entry point.

Return type:typing.Union[AsyncIOTask, typing.Callable[.., asyncio.Task]]
pooled.asynciotask(func, *, loop_getter, loop_getter_need_context)

Wrap to asyncio.Task.

Parameters:
  • func (typing.Optional[typing.Callable[.., typing.Awaitable]]) – function to wrap
  • loop_getter (typing.Union[typing.Callable[.., asyncio.AbstractEventLoop], asyncio.AbstractEventLoop]) – Method to get event loop, if wrap in asyncio task
  • loop_getter_need_context (bool) – Loop getter requires function context
Return type:

typing.Union[AsyncIOTask, typing.Callable[.., asyncio.Task]]