Monitor task freezes and processing times
Watchdog timers are used to detect if a Pipecat task is taking longer than expected. By default, if watchdog timers are enabled and a task takes longer than 5 seconds to reset the timer, a warning will be logged. Watchdog timers are very common in real-time applications to detect if things are frozen or taking too much time. Usually, you start the watchdog and you need to keep resetting it before the watchdog timer timeout expires.
In Pipecat, watchdog timers are available if you create a task using the FrameProcessor.create_task()
method. If you use asyncio.create_task()
or loop.create_task()
, watchdog timers will not work.
Watchdog timers are disabled by default. You can enable and configure them using the following PipelineTask
constructor arguments:
Watchdog timer timeout.
Whether to print task processing times.
Whether to enable watchdog timers.
It is possible to configure watchdog timers individually for each FrameProcessor
, using the same argument names in the constructor, or even per task when creating them with FrameProcessor.create_task()
.
Watchdog timers are always available for every created Pipecat task:
enable_watchdog_timers
.FrameProcessor.create_task()
and its watchdog timer is started.self.reset_watchdog()
to prevent the watchdog timer to expireFrameProcessor.create_task()
)PipelineTask
, per FrameProcessor
or per task