Matthew Blau
04/02/2021, 1:34 PM@task(max_retries=3)
but how can I set up the retry logic if I am not setting up tasks with the functional API? I do not see anything in the docs that explains. Thank you in advance!Zach Angell
Task
class takes a max_retries
argument, if you pass max_retries
to super().init
, your custom task will use this valueZach Angell
class CustomTask(Task):
def __init__(self, my_arg, **kwargs):
self.prop = my_arg
super().__init__(**kwargs)
Zach Angell
my_custom_task = CustomTask(my_arg='foo', kwargs={'max_retries':100})
Matthew Blau
04/02/2021, 2:28 PMwith Flow(name="integration", state_handlers=[slack_notifier],) as flow: start_container = start(container_id=container) code = status_code(container_id=container, upstream_tasks=[start_container]) collect_logs = logs(container_id=container, upstream_tasks=[code])
so what you're saying is that I can pass in {'max_retires':3} to the start_container task?
Kevin Kho
start_container
task you have?emre
04/02/2021, 2:39 PMstart = StartContainer(max_retries=3)
with Flow(name="integration", state_handlers=[slack_notifier],) as flow:
start_container = start(container_id=container)
code = status_code(container_id=container, upstream_tasks=[start_container])
collect_logs = logs(container_id=container, upstream_tasks=[code])
tasks need to be first initialized, and then called.
Assuming you got your example from: https://docs.prefect.io/core/examples/functional_docker.html btw 😅Kevin Kho
Matthew Blau
04/02/2021, 2:43 PM