Retries

Retries allow you to re-run a task upon failure. They're pretty easy to configure:

For class-based tasks, you can adjust the number of times a task should be retried by setting the RETRIES and RETRY_DELAY_SECONDS class attributes:

  • RETRIES: the number of times the task should be retried. Default is 0.

  • RETRY_DELAY_SECONDS: the number of seconds to wait in between retries. Must be specified alongside RETRIES. Default is 0.

For example:

# tasks/example_task.py

import prism.task

class ExampleTask(prism.task.PrismTask):
    
    RETRIES = 1
    RETRY_DELAY_SECONDS = 60
        
    def run(self, tasks, hooks):
        test_str = "Hello, world!"
        return test_str

Last updated