How do I add max_retries to a Task class? I modifi...
# prefect-community
z
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.
k
Hey @Zach, You should be able to add that kwarg when you instantiate the custom task like this:
Copy code
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)
👍 1