spdl.pipeline.create_task¶
- create_task(coro: Coroutine[Any, Any, T], name: str | None = None, log_cancelled: bool = False, suppress_repeated_logs: bool = False, suppression_threshold: int = 5, suppression_warning_interval: int = 100) Task[T][source]¶
Wrap
asyncio.create_task()and add logging callback.- Parameters:
coro – The coroutine or generator to be executed as a task.
name – Optional name for the task. If
None, asyncio will generate a default name.log_cancelled – If
True, log a warning when the task is cancelled. Defaults toFalse.suppress_repeated_logs – If
True, suppress repeated exception logs from the same location after reaching the suppression threshold. Defaults toFalse.suppression_threshold – Number of exceptions from the same location before suppression kicks in. Defaults to
5.suppression_warning_interval – Interval at which to log suppression warnings after threshold is reached. Defaults to
100.Returns – Task[T]: The created asyncio Task with exception logging callback attached.