Hi :wave:, If I want to do a consitional retry of ...
# prefect-community
n
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
Hey @Newskooler, is your goal to configure a task to retry only if specific parameters were provided to it?
👍 1
n
Yes
d
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
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 : )