z

    Zach

    2 years ago
    How do I add max_retries to a Task class? I modified the GCSDownloadAsFile class that inherits from GCSBaseTask class, and since this is a class, there is no @task decorator that I can add like
    max_retries=3
    to.
    Kyle Moon-Wright

    Kyle Moon-Wright

    2 years ago
    Hey @Zach, You should be able to add that kwarg when you instantiate the custom task like this:
    class AddTask(Task):
        def run(self, x, y):
            return x + y
    
    a = AddTask(max_retries=3, retry_delay=datetime.timedelta(seconds=5))
    
    with Flow("My Flow") as flow:
        val1 = a(1, 2)
        val2 = a(5, 7)