https://prefect.io logo
n

Newskooler

10/15/2020, 1:57 PM
Hi 👋, If I want to do a consitional retry of a task based on provided paramter, is this the way to do it: https://docs.prefect.io/core/examples/parameterized_flow.html or is there e a way to define this in this decorator itself (or otherwise)?
d

Dylan

10/15/2020, 2:41 PM
Hey @Newskooler, is your goal to configure a task to retry only if specific parameters were provided to it?
👍 1
n

Newskooler

10/15/2020, 3:14 PM
Yes
d

Dylan

10/15/2020, 3:44 PM
if you wrapped your task’s logic in a
try/except
, you can set things up like:
Copy code
try:
  bigquery_client = bigquery.Client()
  bigquery_client.upload(my_dataframe)
except Exception as e:
  if e.message == "bigquery hates me":
    raise RETRY("Bigquery is mean")
  raise FAIL("Something else bad has happened")
You could react to a parameter passed to that task as well
n

Newskooler

10/15/2020, 5:47 PM
Thanks, I will check it out!
Hi @Dylan so are you saying to not use a decorator and instead handle RETRY / FAIL / etc inside the task with
Signals
? 🤔
Nvm; I think I fixed it : )
👍 1
Sates and signals are another super cool feature : )