How to configure retries on a task from a Prefect Collection (in Prefect 2.0)?

Use the with_options syntax as follows:

from prefect import flow
from prefect_shell import shell_run_command


@flow
def example_shell_run_command_flow():
    return shell_run_command.with_options(retries=5, retry_delay_seconds=30)(
        command="ls .", return_all=True
    )


if __name__ == "__main__":
    example_shell_run_command_flow()
1 Like