pyncette.utils module

pyncette.utils.with_heartbeat(lease_remaining_ratio: float = 0.5, cancel_on_lease_lost: bool = False) → Callable[[pyncette.model.TaskFunc], pyncette.model.TaskFunc][source]

Decorate the task to use automatic heartbeating in background.

Parameters:
  • lease_remaining_ratio – Number between 0 and 1. The ratio between elapsed time and the lease duration when heartbeating will be performed. Default is 0.5.
  • cancel_on_lease_lost – Whether the task should be cancelled if lease expires. Default is False.