https://prefect.io logo
p

Priyank

07/14/2023, 3:07 PM
Hi, How do I retry a failed task within a flow, or change state of a task from any state, can't see any option to change state, and btw I am using prefect 2.
1
g

Gregory Hunt

07/14/2023, 3:11 PM
The status says scheduled, which means it hasn't run yet
p

Priyank

07/14/2023, 3:15 PM
but i want to run it immediately because for the purpose for which this task was rescheduled is complete and I want it to run immediately, I was able to do so in Prefect 1 but how in Prefect 2
see this from prefect 1, we were able to restart/retry the task whenever we want and even we can pause/resume the state
g

Gregory Hunt

07/14/2023, 3:31 PM
Hmm I have only used prefect 2
p

Priyank

07/14/2023, 3:36 PM
we're migrating to Prefect 2 and this is one of the basic thing that we need to use very frequently. @Chris Reuter @Christopher Boyd can you guys share something on this topic?
@Shridhar Sharma we should clarify all these things before we go for the paid cloud version.
💯 3
b

Bianca Hoch

07/14/2023, 9:25 PM
Hi @Priyank! Can you describe your desired behavior a bit more? Are you trying to retry a task or a flow in the event of failure? Flow and task retries can be accomplished by passing in the
retries
argument to the task or flow.
You can also pause flow runs from directly in the flow code as well.
We'd be happy to hop on a call if you'd like to talk through your use case and get a better understanding the features you're looking for.
👀 1
👍 1
p

Priyank

07/17/2023, 6:10 AM
@Bianca Hoch retries is good, we can mention in the code that this task should retry itself this many number of times, and after these mentioned retries if it fails then it will be marked as crashed. And I can't see any button to restart this specific task. In our case flows are going to be very large, a lot of times it happens multiple tasks get failed in the run, because of some unhandled errors can be different for each task. Now before we even get to identify the issue the max retry limit exceeds or lets say I have fixed the issue and I want this task to run immediately, or lets say the task and all its downstream tasks are completed but they ran reading old configurations (configs we store in shared files) and now after updating my configurations I want to re-run this successful task and all its downstream tasks. In Prefect 1 it was pretty easy to do so, there was a restart button for every task and flow and we just hit that button for restarting that task doesn't matter in which state it is failed, successful, or whatever, and all its downstream tasks restarts as well.