Hello Prefect-community..hope you all are good. I want to ask a doubt which is regarding prefect2.
@task(name="{task_name}",retries=0,retry_delay_seconds=0,task_run_name="{task_name}")def run_helix_pipeline(task_name: Optional[str] = "run_helix_pipeline",number_of_retries: int = 0) -> None:pass
I want to assign task_name in the name parameter of task decorator and similarly I want to assign retries by number_of_retries. But I am not able to do so. I read the documentation we are able to do it for task_run_name parameter in the task decorator but not for name and retries parameter. Do we have a way through which we can achieve the same?
✅ 1
z
Zanie
04/24/2023, 5:40 PM
Instead you should do
run_helix_pipeline.with_options(retries=…)
in your flow
That’ll get you a new copy of the task with your desired setting