Task Backoff¶
Use exponential backoff to increase the delay between retries. Each retry waits twice as long as the previous one. Enable it with backoff=True on the @action decorator alongside retry and retry_delay.
Example¶
from dotflow import DotFlow, action
@action(retry=1, backoff=True)
def simple_step():
raise Exception("Unknown")
@action
class SimpleStepX:
@action(retry=1, backoff=True)
def run(self):
raise Exception("Unknown")
@action(retry=1, backoff=True)
class SimpleStepY:
@action
def run(self):
raise Exception("Unknown")
def main():
workflow = DotFlow()
workflow.task.add(step=simple_step)
workflow.start()
workflow.task.clear()
workflow.task.add(step=SimpleStepX)
workflow.start()
workflow.task.clear()
workflow.task.add(step=SimpleStepY)
workflow.start()
workflow.task.clear()
return workflow
if __name__ == "__main__":
main()