https://flyte.org logo
Title
t

tim leonard

04/19/2023, 11:42 PM
I've got a workflow that looks like this [get url from API] -> [download url] -> [validate download] I'm dealing with situations where the third step
validate download
fails. This usually can be resolved by retrying the download. Is there any way to have a workflow retrigger itself in flyte? Basically if I see an error on
validate download
can i just restart the workflow?
g

Greg Gydush

04/19/2023, 11:46 PM
Can you do it at the task level and throw a FlyteRecoverableException? https://docs.flyte.org/projects/flytekit/en/latest/design/authoring.html#exception-handling
k

Ketan (kumare3)

04/20/2023, 4:04 AM
is this what you want
url = get_url
while True:
  try:
    download(url)
    validate(url)
    return True
  except:
    pass
t

tim leonard

04/20/2023, 3:48 PM
Thanks Greg -
FlyteRecoverableException
looks like what I need. I can throw that, and then set
@task(retries=10)
so that it retries. Ketan - that solution would work fine within a task, but my download and validate fns are flyte tasks themselves. Would the
while true: try
structure work in a workflow? I haven't tried that.
k

Ketan (kumare3)

04/20/2023, 7:38 PM
hmm it doesnt today
but there is some work in progress 🙂