Wojciech Kieliszek
03/14/2023, 12:07 PMstart_time = datetime.utcnow() + timedelta(seconds=retry_after)
raise signals.RETRY(
start_time=start_time,
message=f"Rate limited. Waiting {retry_after}s.",
)
This way I could implement my own retry logic (e.g. not based only on exception class, but exception data and define retry_after
based on the API response).
Is it possible with Prefect v2? I am searching the docs, but couldn’t find if returning or raising states manually is supported. Something like this:
start_time = pendulum.now("UTC").add(seconds=retry_after)
return AwaitingRetry(
scheduled_time=start_time,
message=f"Rate limited. Waiting {retry_after}s.",
)
Ryan Peden
03/14/2023, 12:31 PMWojciech Kieliszek
03/14/2023, 2:33 PMAwaitingRetry
like:
start_time = pendulum.now("UTC").add(seconds=retry_after)
return AwaitingRetry(
scheduled_time=start_time,
message=f"Rate limited. Waiting {retry_after}s.",
)
I am getting:
This run cannot transition to the StateType.SCHEDULED state from the StateType.RUNNING state.
inside set_task_run_state
. Does it mean we cannot manually retry task with custom scheduled_time
?