Recurring tasks
A task or workflow can be configured to automatically re-execute after it completes successfully, by setting recurrent=True:
@cf.workflow(recurrent=True)
def poll_for_updates():
updates = fetch_updates()
for update in updates:
process_update.submit(update)
The task recurs as long as it returns None. Returning any other value completes the cycle and stops recurrence. The run can also be stopped by cancelling it, or if an error occurs (without a successful retry).
Delay
By default, recurring tasks restart immediately. Use delay to wait between executions:
@cf.workflow(recurrent=True, delay=60)
def poll_every_minute():
...
The delay is in seconds (or pass a timedelta).
Retries
Recurring tasks can be combined with retries. If a task fails, retries are attempted first. Only successful completions trigger the next recurrence.
@cf.workflow(recurrent=True, delay=60, retries=3)
def resilient_polling():
...